Re: [Sqlalchemy-users] TimeDelta Natural Language

2006-06-26 Thread Tim Lesher
On 6/25/06, Dirk Stoop [EMAIL PROTECTED] wrote: python-dateutil is very cool for getting a correct date from a relative difference, it seems like they put a lot of work in getting all of the nasty bits (like leapyears etc.) right, but does anyone know about a library that can do this the other

[Sqlalchemy-users] pool and transparency

2006-06-26 Thread Jonathan Ellis
The one (?) place that sqlalchemy pool isn't really transparent is wrt closing connections.Consider this function --def foo(): conn = psycopg2.connect(...) c = conn.cursor() c.execute('select * from users') To keep this correct in a pooled environment, I have to manually add conn.rollback() or

Re: [Sqlalchemy-users] pool and transparency

2006-06-26 Thread Michael Bayer
On Jun 26, 2006, at 12:09 PM, Jonathan Ellis wrote: The one (?) place that sqlalchemy pool isn't really transparent is wrt closing connections. Consider this function -- def foo(): conn = psycopg2.connect(...) c = conn.cursor() c.execute('select * from users') To keep this

[Sqlalchemy-users] IntegrityError, bug with test case

2006-06-26 Thread Tim Van Steenburgh
Test script and stack trace below:import sqlalchemy.mods.threadlocalfrom sqlalchemy import *sqlite = 'sqlite:///:memory:'db = create_engine(sqlite, strategy='plain', echo=True) metadata = BoundMetaData(db)# TABLE

Re: [Sqlalchemy-users] strange initialization problem with latest trunk

2006-06-26 Thread Michael Bayer
I made a change that should fix this in changeset 1660. On Jun 23, 2006, at 3:21 PM, Brad Clements wrote: On 22 Jun 2006 at 23:44, Michael Bayer wrote: a lot has changed with mapper initialization (and plenty of bugs), but not tables. can you send a test example ? Sorry my example

Re: [Sqlalchemy-users] IntegrityError, bug with test case

2006-06-26 Thread Michael Bayer
this was something reasonably stupid (the bug in the code, not the test case !)  and is fixed in 1663 .On Jun 26, 2006, at 2:27 PM, Tim Van Steenburgh wrote:Test script and stack trace below:import sqlalchemy.mods.threadlocalfrom sqlalchemy import *sqlite = 'sqlite:///:memory:'db =

Re: [Sqlalchemy-users] Serial column created for secondary table fields

2006-06-26 Thread Michael Bayer
the change to not produce SERIAL when a ForeignKey is present is committed in changeset 1664. MySQL already had this logic in place with regards to AUTO_INCREMENT. On Jun 23, 2006, at 5:09 PM, Randall Smith wrote: In a secondary table used for many to many relationships, usually a

Re: [Sqlalchemy-users] pool and transparency

2006-06-26 Thread Michael Bayer
On Jun 26, 2006, at 12:53 PM, Jonathan Ellis wrote: I'd still like to see this mentioned in the docs, though. :) consider it mentioned ! (or look at it mentioned on the pooling page) Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with

Re: [Sqlalchemy-users] threads / unit of work and cherrypy

2006-06-26 Thread Randall Smith
Michael, Thanks for the advice. I'm working with TurboGears and determined to use SA, but having a tough time. TG defines a PackageEngine which is a subclass of AutoConnectEngine. The SA imports look like this: import sqlalchemy.mods.threadlocal import sqlalchemy from

Re: [Sqlalchemy-users] SQLAlchemy and locking up.

2006-06-26 Thread Dennis Muhlestein
On 6/25/06, Michael Bayer [EMAIL PROTECTED] wrote: you should try 1657 to see if it solves your problems right now. I am also posting on the Python list to see what they think of formally allowing the Lock to be configurable, or at least making it an RLock (someone else also wanted this feature :

[Sqlalchemy-users] Looking for easy way to create select statement

2006-06-26 Thread Mike Bernson
I must be missing something. I have a dict of keys and values that I want to build a select statement from. The dict is of the form dict['key1'] = value1 dict['key2'] = value2 dict['key3'] = value3 I want to build a select statement that has a where clause where key1 = value1 and key2 =

Re: [Sqlalchemy-users] threads / unit of work and cherrypy

2006-06-26 Thread Michael Bayer
you might want to temporarily disregard whatever theyre doing with turbogears, since it seems theyre still using patterns that are only relevant to the 0.1 series, particularly the AutoConnectEngine which is totally obsolete, and it seems theres a level of conceptual confusion going on

Re: [Sqlalchemy-users] Looking for easy way to create select statement

2006-06-26 Thread Michael Bayer
On Jun 26, 2006, at 7:47 PM, Mike Bernson wrote: I must be missing something. I have a dict of keys and values that I want to build a select statement from. The dict is of the form dict['key1'] = value1 dict['key2'] = value2 dict['key3'] = value3 I want to build a select

Re: [Sqlalchemy-users] strange initialization problem with latest trunk

2006-06-26 Thread Brad Clements
On 26 Jun 2006 at 15:30, Michael Bayer wrote: I made a change that should fix this in changeset 1660. It appears to be fixed, thanks -- Brad Clements,[EMAIL PROTECTED](315)268-1000 http://www.murkworks.com AOL-IM or SKYPE: BKClements Using

[Sqlalchemy-users] mapper.options - attribute error

2006-06-26 Thread Brad Clements
SVN revision 1666 I am looking at More on Mapper Options on http://sqlalchemy.org/docs/adv_datamapping.myt I have a generic wsgi middleware that takes a table name and returns data from that table. For one table, I want to hide one field. That is, for table named 'coordinator' I want to

Re: [Sqlalchemy-users] mapper.options - attribute error

2006-06-26 Thread Michael Bayer
noload() is used only for multi-table relations(), to indicate that a secondary relation should not be eager or lazy loaded. what youre looking for is almost like deferred column loading (http://www.sqlalchemy.org/docs/ adv_datamapping.myt#advdatamapping_properties_deferred) but i guess

Re: [Sqlalchemy-users] threads / unit of work and cherrypy

2006-06-26 Thread Randall Smith
Michael Bayer wrote: it seems from symptom 1 and symptom 2 that your objects are not finding their way into Sessions, or are getting removed. if you stick with the simpler pattern above, it should be clear what Session your objects are a part of. symptom 2 also should be raising an

Re: [Sqlalchemy-users] threads / unit of work and cherrypy

2006-06-26 Thread Randall Smith
I think I made some progress and wanted to share it. I'm forced to use threadlocal because TurboGears uses it. My SA definitions exist outside of TG so I have to associate a connection to them after they are imported, and that's where I've been hung up. When sqlalchemy.mods.threadlocal is