Re: [sqlalchemy] storedprocedure with input parameter

2011-07-28 Thread werner
Conor, On 07/27/2011 05:54 PM, Conor wrote: On 07/27/2011 10:42 AM, werner wrote: I like to use a stored procure which needs a input parameter in something like this: seltest = db.sa.select([id, name]).select_from(db.sa.func.someStoredProc(2)).alias() seltestm = db.sao.mapper(ATest,

Re: [sqlalchemy] Order by ordinal position

2011-07-28 Thread Christoph Zwerschke
Am 28.07.2011 00:41 schrieb Michael Bayer: order_by() is accepting SQL expressions, not values, so it is consistent that values should be coerced to SQL first in this case literal_column(1), etc. My thought was that if order_by automatically coerces strings, i.e. order_by('1') works, then it

[sqlalchemy] Table creation/deletetion checkfirst parameter in mssql+pyodbc

2011-07-28 Thread Michael Kvyatkovskiy
Hello. I'm using Microsoft Sql Server 2008, sqlalchemy 0.7.1. When I'm trying to create table using metadata.create_all method with checkfirst=True, an axception is raised. I set option convert_unicode=True in engine initialization. Here is the backtrace: ... File ..., line 32, in

Re: [sqlalchemy] Table creation/deletetion checkfirst parameter in mssql+pyodbc

2011-07-28 Thread Michael Bayer
On Jul 28, 2011, at 10:34 AM, Michael Kvyatkovskiy wrote: Hello. I'm using Microsoft Sql Server 2008, sqlalchemy 0.7.1. When I'm trying to create table using metadata.create_all method with checkfirst=True, an axception is raised. I set option convert_unicode=True in engine

Re: [sqlalchemy] Newbie question

2011-07-28 Thread Kent Tenney
On Wed, Jul 27, 2011 at 2:48 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 27, 2011, at 3:21 PM, Kent Tenney wrote: Howdy, I'm aggregating data from several Sqlite files into a Postgres db. The sqlite files are storage for several apps I use: Shotwell, Firefox, Zotero, Banshee

Re: [sqlalchemy] Newbie question

2011-07-28 Thread Michael Bayer
On Jul 28, 2011, at 11:47 AM, Kent Tenney wrote: It offers choices in that you can A. use core only or B. the ORM, as well as choices in that it works with whatever kind of schema you'd like, I'll be studying doc for a better idea of the A/B distinction, as well as what kinds of schemas

[sqlalchemy] intersecting query with different numbers of selectables

2011-07-28 Thread Eduardo
Dear all, I have 2 queries: 1) query1=session.query(func.max(datab.columns['counter']).label('t1')).group_by(datab.columns['site']) query2=session.query(tab.columns['name'],tab.columns['id'],tab.columns['counter']).filter(datab.columns['visits']==15) Now I would like to get all pairs

Re: [sqlalchemy] Delay in getting the response object and populating data to UI page using Python, SQLAlchemy, MySQL

2011-07-28 Thread Fayaz Yusuf Khan
On Wednesday 15 Jun 2011 11:44:32 AM Bala wrote: def write(self, params): if 'id' in params: ticket = self.dao.FindByID(Ticket, params['id'][0]) ticket.modified = datetime.datetime.now() else:

[sqlalchemy] Re: Table creation/deletetion checkfirst parameter in mssql+pyodbc

2011-07-28 Thread Michael Kvyatkovskiy
Thank you for the response! On 28 июл, 19:07, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 28, 2011, at 10:34 AM, Michael Kvyatkovskiy wrote: the test case you'd like to try is (seehttp://code.google.com/p/pyodbc/wiki/ConnectionStringsfor connect strings) : import pyodbc conn =

[sqlalchemy] Question about @validates decorator

2011-07-28 Thread Stefano Fontanelli
Hi folks, I'm working on a project which uses SQLAlchemy as ORM layer and I have a question about @validates decorator. How can I get a list of functions (in each entity of my model) that are decorated using sqlalchemy.orm.validates decorator? Regards, Stefano. -- You received this

Re: [sqlalchemy] Re: Cascade Deletes

2011-07-28 Thread Stefano Fontanelli
Il 28/07/11 01.15, Aviv Giladi ha scritto: Hi, I am actually using both MySQL and SQLite (one on the dev machine, one on the server). Does that make a difference? ONDELETE and ONUPDATE don't work on SQLite and MySQL MyISAM. You must change your database to test them. In MySQL you can create

Re: [sqlalchemy] Question about @validates decorator

2011-07-28 Thread Michael Bayer
h well there's not a public API for that. Right now (and with no immediate plans to change it) the function should have an attribute called __sa_validators__ which is a list of attribute names.Ultimately there are attribute events assigned though the event API doesn't have a

[sqlalchemy] orm mapper polymorphic_identity as collection

2011-07-28 Thread neurino
I need a Single Table Inheritance where the `type` column already exists and is a foreign key - `id_type` - to `types` table. My concern is I only need to map to two different classes: - Foo for `polymorphic_identity=FOO_ID_TYPE` - Bar for all other `id_type`s Is there a way I can accomplish

Re: [sqlalchemy] orm mapper polymorphic_identity as collection

2011-07-28 Thread Michael Bayer
On Jul 28, 2011, at 4:23 PM, neurino wrote: I need a Single Table Inheritance where the `type` column already exists and is a foreign key - `id_type` - to `types` table. My concern is I only need to map to two different classes: - Foo for `polymorphic_identity=FOO_ID_TYPE` - Bar for all

Re: [sqlalchemy] orm mapper polymorphic_identity as collection

2011-07-28 Thread neurino
Thanks Michael, my need is quite easy, no need of complex querying. Simply my class represents a Layer and, while quite all layer types (concrete, wood, bricks, etc.) act the same, only one (air) acts in a completely different way. With act I refer to performing calculations on float

Re: [sqlalchemy] orm mapper polymorphic_identity as collection

2011-07-28 Thread Michael Bayer
On Jul 28, 2011, at 6:08 PM, neurino wrote: Thanks Michael, my need is quite easy, no need of complex querying. Simply my class represents a Layer and, while quite all layer types (concrete, wood, bricks, etc.) act the same, only one (air) acts in a completely different way. With

Re: [sqlalchemy] orm mapper polymorphic_identity as collection

2011-07-28 Thread neurino
I tried create_instance event and it fires, now having: def see_what_type(mapper, context, row, class_): if **is_air**: return Air() else: return EXT_CONTINUE def initialize_sql(engine): ... layer_mapper = mapper(Layer, layers) mapper(Air,

[sqlalchemy] Re: Database-side data mangling

2011-07-28 Thread Sergey V.
Thanks for your answer Michael. I experimented with column_property and generally it works, however now I have 2 separate attributes - one for setting a value and another, read-only one, for reading the modified value. class User(Base): ... email = sa.Column(String)

[sqlalchemy] Re: sqlalchemy + beaker cache

2011-07-28 Thread espresso maker
Anyone know of another sqlalchemy + beaker example I can look it? On Jul 27, 2:05 pm, espresso maker espressso.ma...@gmail.com wrote: Hi there, I am trying to follow the setup in this examplehttp://www.sqlalchemy.org/trac/browser/examples/beaker_cachingto enable beaker caching in