[sqlalchemy] Re: Python's reserved keywords as column names

2010-09-13 Thread Andrey Semyonov
Thanks to all of you. Dict-style mapping declaration helped. -- 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

Re: [sqlalchemy] add if relationship is involved

2010-09-13 Thread Michael Bayer
Thanks. That's a bug, and it is fixed in r4bc3ace1f2f0. You can download r4bc3ace1f2f0 by going to: http://hg.sqlalchemy.org/sqlalchemy/archive/4bc3ace1f2f0.tar.gz or the latest default: http://hg.sqlalchemy.org/sqlalchemy/archive/default.tar.gz The fix will be in 0.6.5. A

Re: [sqlalchemy] passive_deletes/updates with sqlite

2010-09-13 Thread Michael Bayer
On Sep 12, 2010, at 11:02 PM, alex bodnaru wrote: thanks a lot michael. indeed it works, but it seems counter-intuitive a little since passive_* should in my opinion be on the side of the on * cascade it describes. anyway, it's great, and hope to make it work with elixir too. If you said

[sqlalchemy] Oracle setinputsizes usage (just making sure)

2010-09-13 Thread Kevin Mills
I just want to make sure that what I am reading at http://www.sqlalchemy.org/docs/dialects/oracle.html#connecting is correct when connecting to an Oracle database using sqa. When I was using cx_Oracle directly I would have to use cursor.setinputseizes when I am using bind variables (especially

[sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Jon Siddle
I'm sure I'm missing something simple here, and any pointers in the right direction would be greatly appreciated. Take for instance the following code: session = Session() parents = session.query(Parent).options(joinedload(Parent.children)).all() session.close() print parents[0].children #

Re: [sqlalchemy] Oracle setinputsizes usage (just making sure)

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 8:26 AM, Kevin Mills wrote: I just want to make sure that what I am reading at http://www.sqlalchemy.org/docs/dialects/oracle.html#connecting is correct when connecting to an Oracle database using sqa. When I was using cx_Oracle directly I would have to use

Re: [sqlalchemy] passive_deletes/updates with sqlite

2010-09-13 Thread alex bodnaru
On 09/13/2010 08:32 AM, Michael Bayer wrote: On Sep 12, 2010, at 11:02 PM, alex bodnaru wrote: thanks a lot michael. indeed it works, but it seems counter-intuitive a little since passive_* should in my opinion be on the side of the on * cascade it describes. anyway, it's great, and hope

Re: [sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 8:48 AM, Jon Siddle wrote: I'm sure I'm missing something simple here, and any pointers in the right direction would be greatly appreciated. Take for instance the following code: session = Session() parents =

Re: [sqlalchemy] passive_deletes/updates with sqlite

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 11:16 AM, alex bodnaru wrote: hope my approach isn't too simplist, but onetomany is usually implemented in rdbms by an manytoone column or a few of them, with or without ri clauses: thus, a foreign key or an index. conversely, a manytoone relation has an implicit

Re: [sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 11:45 AM, Michael Bayer wrote: In the specific case you have above, you can also use a trick which is to use contains_eager(): parents = session.query(Parent).options(joinedload(Parent.children), contains_eager(Parent.children, Child.parent)).all() the above

Re: [sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Jon Siddle
On 13/09/10 16:45, Michael Bayer wrote: On Sep 13, 2010, at 8:48 AM, Jon Siddle wrote: I'm sure I'm missing something simple here, and any pointers in the right direction would be greatly appreciated. Take for instance the following code: session = Session() parents =

[sqlalchemy] paranoia - does flush ensure a unique id?

2010-09-13 Thread Chris Withers
Hi All, Give the following model: from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.types import Integer Base = declarative_base() class Model(Base): __tablename__='test' id = Column(Integer, primary_key=True) col = Column(Integer) ...the following code will

Re: [sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 12:26 PM, Jon Siddle wrote: This relationship is satisfied as you request it, and it works by looking in the current Session's identity map for the primary key stored by the many-to-one. The operation falls under the realm of lazyloading even though no SQL is

[sqlalchemy] Re: Updating a detached object

2010-09-13 Thread Alvaro Reinoso
If I merge the updated channel like you can see in this piece of code it's working: def insertXML(channels, strXml): Insert a new channel given XML string channel = Channel() session = rdb.Session() channel.fromXML(strXml)

Re: [sqlalchemy] Re: Updating a detached object

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 2:13 PM, Alvaro Reinoso wrote: If I merge the updated channel like you can see in this piece of code it's working: def insertXML(channels, strXml): Insert a new channel given XML string channel = Channel() session =

[sqlalchemy] Re: Updating a detached object

2010-09-13 Thread Alvaro Reinoso
Yes, I've done that. I doesn't work either. for chan in channels: if chan.id == channel.id: chan = session.merge(channel) break On Sep 13, 2:27 pm, Michael

Re: [sqlalchemy] Re: Updating a detached object

2010-09-13 Thread Michael Bayer
On Sep 13, 2010, at 2:31 PM, Alvaro Reinoso wrote: Yes, I've done that. I doesn't work either. for chan in channels: if chan.id == channel.id: chan = session.merge(channel)

[sqlalchemy] Postgresql Partition / INHERIT and table names....

2010-09-13 Thread Gregg Lind
Suppose this is my table: a_table = Table( 'a_table', metadata, Column('ts',Integer, index=True, nullable=False), Column('country',String, index=True, nullable=False), Column('somestat',Integer,nullable=False),

[sqlalchemy] Re: Postgresql Partition / INHERIT and table names....

2010-09-13 Thread Gregg Lind
Thank you! I figured a compile visitor might be the right way in, but had no idea of how to do it! Some tutorials just on the visitors would probably explain a lot about how PG works! Cheers! GL On Sep 13, 2:14 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Sep 13, 2010, at 2:48 PM,

Re: [sqlalchemy] Re: Postgresql Partition / INHERIT and table names....

2010-09-13 Thread Jon Nelson
On Mon, Sep 13, 2010 at 3:39 PM, Gregg Lind gregg.l...@gmail.com wrote: So, there is a slight wart here: q = select(Partition(t1,'myt1')) q.append_column(Partition(t1,'myt1').c.data) will give: from myt1,myt1 I think this is an artifact of the   'alias' heritage.  Ideas? Don't

[sqlalchemy] internationalization of content

2010-09-13 Thread NiL
Hi all, I'm lookin for a good solution to internationalize the content of my application. that is provide many translations for the database content (as opposed to the translation of the application itself with babel/gettext for template and code messages). Has anyone tried ti implement this ? a

Re: [sqlalchemy] sqlalchemy and desktop apps

2010-09-13 Thread Tim Black
I'm not sure to what extent it works at present, but someone ported OpenERP server to work with SQLAlchemy: http://openerp-team.blogspot.com/2009/08/open-erp-server-with-mysql.html And some parts of OpenERP look like they use SQLAlchemy: