[sqlalchemy] Re: Sqla related talks at pycon

2011-01-17 Thread dusans
me waiting for the book :) On 17 jan., 17:22, Michael Bayer wrote: > Not this year.   I hope at least some of the talks are about projects where > SQLAlchemy was used, though. > > My own tutorials I feel try to cover too much in a compacted space, leaving > some users confused and others bored,

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Michael Bayer
On Jan 17, 2011, at 5:42 PM, Jan Mueller wrote: >> try: >> obj = Session.query(MyObject).filter(MyObject.updated_at == >> my_hidden_updated_at).filter(MyObject.id == id).one() >> except orm.exc.NoResultFound: >> print "stale version !" >> >> for

[sqlalchemy] sqla and sqlite3

2011-01-17 Thread Jan Mueller
Hi all, some thoughts about sqla and sqlite3. is it an issue, that sqla throws an operationalerror with the message "the database is locked" in case of too many concurrent operations on one db file? i found a post about this problem with trac some years ago... i tested a script for loading s

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Jan Mueller
On 01/17/2011 05:14 PM, Michael Bayer wrote: On Jan 16, 2011, at 8:15 PM, Jan Mueller wrote: Ok then i will try to explain it: I have a pylons web application... and i want to use the entity attribute updated_at as a Datetime version_id... so i modified the entity with the mapper args and put

Re: [sqlalchemy] passive Query

2011-01-17 Thread Eric Lemoine
Thanks Mike and Alexandre for your responses. On Mon, Jan 17, 2011 at 5:27 PM, Michael Bayer wrote: > Well obviously you could mock it. I don't want to mock it because I want to check the resulting query statement. > > A few years back Jason wrote a statement "recorder/replayer" which can > si

Re: [sqlalchemy] Getting float back from select when asdecimal is True (version 0.6.6)

2011-01-17 Thread Roger Hoover
This is my fault. The schema for my unit test DB has this column as DOUBLE, where as my main DB was DECIMAL. Sorry to waste your time. It's working correctly now. On Mon, Jan 17, 2011 at 11:16 AM, Michael Bayer wrote: > Check your version of MySQLdb. MySQLdb returns the Decimal directly, > p

Re: [sqlalchemy] Getting float back from select when asdecimal is True (version 0.6.6)

2011-01-17 Thread Michael Bayer
Check your version of MySQLdb. MySQLdb returns the Decimal directly, perhaps that wasn't the case for older versions. from sqlalchemy import * from decimal import Decimal engine = create_engine("mysql://scott:tiger@localhost/test", strategy='threadlocal', pool_recycle=10, encoding='utf-8', co

[sqlalchemy] Getting float back from select when asdecimal is True (version 0.6.6)

2011-01-17 Thread The Dude
Hi, Thank you for SQLAlchemy. I've had a great experience with it so far. I'm running into an issue where I've declared the column type to use decimal.Decimal but I get float back from select. I'd appreciate any clues you might have. url = 'mysql://%s:%s@%s:%d/%s' % (cfg['login'], cfg['passwor

Re: [sqlalchemy] passive Query

2011-01-17 Thread Alexandre Conrad
I use "mock.patch" http://www.voidspace.org.uk/python/mock/patch.html. I don't use it with SQLA, but I'm writing a wrapper around a webservice with a very similar SQLA API that needs to avoid making outgoing http requests during tests. You can you mock.patch as a decorator or as a "with" statement.

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Michael Bayer
On Jan 17, 2011, at 11:14 AM, Michael Bayer wrote: > > > However, interesting here is that you're merging, and I wonder if merge() > should be also checking version_id col for a stale version - that might be > the correct way for SQLA to behave in this case. I'm going to check what > Hibern

Re: [sqlalchemy] passive Query

2011-01-17 Thread Michael Bayer
Well obviously you could mock it. A few years back Jason wrote a statement "recorder/replayer" which can simulate a DBAPI receiving/returning an exact series of statements/results, it involves first recording the database interaction into memory and specifically is not for mocking, though I

Re: [sqlalchemy] Sqla related talks at pycon

2011-01-17 Thread Michael Bayer
Not this year. I hope at least some of the talks are about projects where SQLAlchemy was used, though. My own tutorials I feel try to cover too much in a compacted space, leaving some users confused and others bored, so I've not felt good about that. They also take a ton of time to prepare,

Re: [sqlalchemy] how to use version_id_col

2011-01-17 Thread Michael Bayer
On Jan 16, 2011, at 8:15 PM, Jan Mueller wrote: > Ok then i will try to explain it: > > I have a pylons web application... and i want to use the entity attribute > updated_at as a Datetime version_id... > so i modified the entity with the mapper args and put a hidden input field in > my edit h