Re: [sqlalchemy] Convert Declarative definitions to Table definitions

2010-12-06 Thread Thadeus Burgess
I use ENUM types for postgres. Reflection does not preserve the ENUM name within its sequence. Name is required on postgres. I don't want to edit my 50+ tables and add names to them just for a migration, this is why reflection does not work in my case. -- Thadeus On Mon, Dec 6, 2010 at 4:29 PM

[sqlalchemy] Re: MSSQL: OUTPUT clause is throwing an error on a table with an INSERT trigger

2010-12-06 Thread Randy Syring
Thank you! Ticket for doc addition: http://www.sqlalchemy.org/trac/ticket/1994 On Dec 6, 6:10 pm, Michael Bayer wrote: > specify implicit_returning = False as part of the Table arguments.   Should > probably add a note to the MSSQL docs on this. > > On Dec 6, 2010, at 5:41 PM, Randy Syring wrot

Re: [sqlalchemy] MSSQL: OUTPUT clause is throwing an error on a table with an INSERT trigger

2010-12-06 Thread Michael Bayer
specify implicit_returning = False as part of the Table arguments. Should probably add a note to the MSSQL docs on this. On Dec 6, 2010, at 5:41 PM, Randy Syring wrote: > I am executing a bulk insert which is resulting in SQL like: > > INSERT INTO equipment (equipment_type_id, number, mark,

[sqlalchemy] MSSQL: OUTPUT clause is throwing an error on a table with an INSERT trigger

2010-12-06 Thread Randy Syring
I am executing a bulk insert which is resulting in SQL like: INSERT INTO equipment (equipment_type_id, number, mark, inactive) OUTPUT inserted.id VALUES (?, ?, ?, ?)' (6, u'1', None, 0) But I have a trigger on equipment that does some validity checking. When executing, I get an exception whic

Re: [sqlalchemy] Convert Declarative definitions to Table definitions

2010-12-06 Thread Chris Withers
On 03/12/2010 19:02, Thadeus Burgess wrote: I'm about to use sqlalchemy-migrate, however all of my tables are already in a declarative format. If you're using migrate, you're better off reflecting the tables to be migrated rather than using any script to try and turn declarative models into t

[sqlalchemy] Re: subclass mapped class to add utility methods?

2010-12-06 Thread Daniel Holth
Thank you! I never would have thought of appending a superclass as an alternative to subclassing or monkeypatching. No wonder Python is so hard to optimize. I wound up doing the monkey patch and it seems to work just fine. -- You received this message because you are subscribed to the Google Grou

Re: [sqlalchemy] PyMySQL dialect final patch

2010-12-06 Thread Michael Bayer
thanks I've updated ticket 1991 with this patch. On Dec 6, 2010, at 3:44 PM, Evax Software wrote: > Hi, > > The following patch replaces the previous one with the fix mentioned > in the previous thread included. > It also fixes the test cases to handle pymysql properly (that is > exactly as MyS

Re: [sqlalchemy] subclass mapped class to add utility methods?

2010-12-06 Thread Michael Bayer
On Dec 6, 2010, at 3:29 PM, Daniel Holth wrote: > I am trying to subclass a mapped class from another package for no > other reason than to add a utility method. The polymorphic_on > condition, if it were defined, would have to be 'True'. Example: > > class Mapped(declarative_base()): > # colu

Re: [sqlalchemy] Problem with one relation

2010-12-06 Thread Michael Bayer
On Dec 6, 2010, at 2:39 PM, Alvaro Reinoso wrote: > Hi all, > > I have those two classes: > > class Playlist(rdb.Model): > """Represents playlist. It may contain playlist items""" > rdb.metadata(metadata) > rdb.tablename("playlists") > > id = Column("id", Integer, prima

Re: [sqlalchemy] default order_by with declarative

2010-12-06 Thread Michael Bayer
mapper has an "order_by" argument which is used to establish the default ordering when Query is used. Mapper configuration with declarative is via the __mapper_args__ dictionary. Both concepts are described in http://www.sqlalchemy.org/docs/orm/mapper_config.html . On Dec 6, 2010, at 9:09

Re: [sqlalchemy] Joinedload with association proxies

2010-12-06 Thread Michael Bayer
On Dec 6, 2010, at 10:31 AM, Ian Thompson wrote: > Hi, > > Apologies if this has been answered or doesn't make sense, I'm still > just getting started here. > > Passing in an association proxy to the joinedload function doesn't > seem to work, I have to use the original name. Is this the expect

Re: [sqlalchemy] does one always have to call session.add ?

2010-12-06 Thread Michael Bayer
Nothing gets placed in the Session initially without at least one call to add().When an object is added which contains references to other objects, or other objects are associated with an object already present in the session, cascade rules take effect which result in those related objects

[sqlalchemy] PyMySQL dialect final patch

2010-12-06 Thread Evax Software
Hi, The following patch replaces the previous one with the fix mentioned in the previous thread included. It also fixes the test cases to handle pymysql properly (that is exactly as MySQLdb) as well as a small typo in Saint Exupéry's snippet :) As the google groups web interface will probably man

Re: [sqlalchemy] Excluding a column form Query result

2010-12-06 Thread Michael Bayer
columns participate in the SQL rendition of a query as they are used within the filter(), group_by(), order_by(), and other similar generative methods on Query. There is no additional step needed. If the columns are owned by a table that is not currently participating in the query, the owning

[sqlalchemy] subclass mapped class to add utility methods?

2010-12-06 Thread Daniel Holth
I am trying to subclass a mapped class from another package for no other reason than to add a utility method. The polymorphic_on condition, if it were defined, would have to be 'True'. Example: class Mapped(declarative_base()): # columns class Utility(Mapped): def is_something(self):

[sqlalchemy] Problem with one relation

2010-12-06 Thread Alvaro Reinoso
Hi all, I have those two classes: class Playlist(rdb.Model): """Represents playlist. It may contain playlist items""" rdb.metadata(metadata) rdb.tablename("playlists") id = Column("id", Integer, primary_key=True) title = Column("title", String(50))

Re: [sqlalchemy] Handling a connection error

2010-12-06 Thread Michael Bayer
On Dec 6, 2010, at 10:50 AM, M3nt0r3 wrote: > HI, > i am trying to handle the error c on connection when db is stopped or > unrechable. > >File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line > 213, in __init__ >self.connection = self.__connect() > >File "/usr/lib/python

Re: [sqlalchemy] Re: Trouble detaching all objects with relationships intact

2010-12-06 Thread Michael Bayer
On Dec 6, 2010, at 11:52 AM, Ian Thompson wrote: > On Dec 6, 4:49 pm, Ian Thompson wrote: >> I've generated a test data set and then want to have all of the >> created objects and relationships available for reference easily. >> To avoid possible pollution of this fixture I want to detach the >>

[sqlalchemy] Re: Trouble detaching all objects with relationships intact

2010-12-06 Thread Ian Thompson
On Dec 6, 4:49 pm, Ian Thompson wrote: > I've generated a test data set and then want to have all of the > created objects and relationships available for reference easily. > To avoid possible pollution of this fixture I want to detach the > objects from the sessions to avoid them getting any upda

[sqlalchemy] Trouble detaching all objects with relationships intact

2010-12-06 Thread Ian Thompson
I've generated a test data set and then want to have all of the created objects and relationships available for reference easily. To avoid possible pollution of this fixture I want to detach the objects from the sessions to avoid them getting any updates applied. To do this I am attempting to load

[sqlalchemy] Handling a connection error

2010-12-06 Thread M3nt0r3
HI, i am trying to handle the error c on connection when db is stopped or unrechable. File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 213, in __init__ self.connection = self.__connect() File "/usr/lib/python2.6/dist-packages/sqlalchemy/pool.py", line 279, in __connect

[sqlalchemy] Joinedload with association proxies

2010-12-06 Thread Ian Thompson
Hi, Apologies if this has been answered or doesn't make sense, I'm still just getting started here. Passing in an association proxy to the joinedload function doesn't seem to work, I have to use the original name. Is this the expected behaviour or am I doing something stupid? class SomeTable

[sqlalchemy] default order_by with declarative

2010-12-06 Thread Nagy Viktor
hi, how can I specify the default ordering of a declaratively given table? Viktor -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sq

[sqlalchemy] does one always have to call session.add ?

2010-12-06 Thread werner
Hi, I sometimes see this type of error: Traceback (most recent call last): File "dialognewwine.pyo", line 750, in OnSaveButton File "dialognewwine.pyo", line 768, in SaveData File "sqlalchemy\orm\session.pyo", line 924, in refresh File "sqlalchemy\orm\session.pyo", line 1234, in _valida