[sqlalchemy] 0.8 - `q.filter(None)` used to do nothing, now generates WHERE NULL

2012-12-18 Thread Yap Sok Ann
There are a few places in my code that does `q.filter(None)`, e.g. something like this: def base_filter(self): # subclasses may set this, or not pass def base_query(self): q = self.model_cls.query q = q.filter(self.base_filter()) return q

[sqlalchemy] Type coercion from raw user input to column's type

2012-12-18 Thread Lukas Lueg
Hi, I've to parse raw user input which ends up as filter-parameters for querys. Consider the following examples, which will end up as where-clauses against date- and decimal-columns (among others). FooDate = 2005/12/04 FooDate = 04.12.2005 BarValue = 100,000.00$ BarValue = USD 10 My

Re: [sqlalchemy] SQLAlchemy ORM instances and direct __dict__ access

2012-12-18 Thread yaniv
I thought about it more. You are correct, there's no way to make this work well (I didn't think of proxying __dict__, I thought of placing pre-bound object proxies inside __dict__ for relations with interface mimicking a-la Werkzeug's object proxies, but those will be brittle and not as

Re: [sqlalchemy] SQLAlchemy ORM instances and direct __dict__ access

2012-12-18 Thread yaniv
Ah, wait, I forgot something important to ask: how should I implement the custom serialization hook? I mean, can someone offer a mixing object with a method that will return a dictionary representation an arbitrary SQLAlchemy instance, including (optional) relation recursion? I'd be grateful

Re: [sqlalchemy] SQLAlchemy 0.8.0b2 released

2012-12-18 Thread Burak Arslan
Hi Michael, This is the only regression I saw migrating from 0.7.9 to 0.8b2: https://travis-ci.org/plq/spyne/jobs/3711648/#L568 The fix was to remove the pformat call: https://github.com/plq/spyne/commit/56580c280945e6d484a5f4ce3fbca682ca698778 The sqla_mapper attribute contains the table

[sqlalchemy] pyodbc connections string with DSN and autocommit Help Please!

2012-12-18 Thread ScottyMac
pyodbc version = 2.1.9-beta16 Trying to connect sqlalchemy to quickbooks enterprise database. Have a DSN setup with Qodbc called quickbooks This connection string works for pyodbc cnxn = pyodbc.connect(‘dsn=quickbooks’, autocommit=True) #Must set autocommit flag or get error message found below.

[sqlalchemy] Disabling subqueries when using joinedload to load a polymorphic class

2012-12-18 Thread Gerald Thibault
I've attached an example showing the issue. I have a class, Test, with a single polymorphic subclass, TestOne. I also have TestChild, which has a fk to Test, and a relation using that fk. When I execute: session.query(TestChild) \ .options(joinedload(TestChild.parent)) \

Re: [sqlalchemy] 0.8 - `q.filter(None)` used to do nothing, now generates WHERE NULL

2012-12-18 Thread Michael Bayer
On Dec 18, 2012, at 3:53 AM, Yap Sok Ann wrote: There are a few places in my code that does `q.filter(None)`, e.g. something like this: def base_filter(self): # subclasses may set this, or not pass def base_query(self): q = self.model_cls.query

Re: [sqlalchemy] SQLAlchemy is trying to insert duplicate rows in an M2M Relationship

2012-12-18 Thread Michael Bayer
I stick with autoflush=True, and flask probably shouldn't make a decision here. But there really shouldn't be any major behavioral changes with autoflush=False other than data stays pending longer, so dynamic here definitely needs some fixes. On Dec 16, 2012, at 2:53 PM, Donald Stufft wrote:

Re: [sqlalchemy] pyodbc connections string with DSN and autocommit Help Please!

2012-12-18 Thread Michael Bayer
there might not be a choice here as the QODBC driver might not support some of the operations that table reflection needs. It's also critical that this database is in fact Microsoft SQL Server, and not something more like Access, because it won't work at all if not. You'd want to set

Re: [sqlalchemy] Disabling subqueries when using joinedload to load a polymorphic class

2012-12-18 Thread Michael Bayer
On Dec 18, 2012, at 3:50 PM, Gerald Thibault wrote: I've attached an example showing the issue. I have a class, Test, with a single polymorphic subclass, TestOne. I also have TestChild, which has a fk to Test, and a relation using that fk. When I execute: session.query(TestChild) \

Re: [sqlalchemy] SQLAlchemy 0.8.0b2 released

2012-12-18 Thread Michael Bayer
seems like it's hitting some revised rules for evaluating clauses in a boolean context, as pprint attempts to sort the contents of the Mapper object's __dict__.In particular, you can't say bool(Column('x') Column('y')) anymore, in 0.7 it would basically make a random guess as to what the

Re: [sqlalchemy] How I can filter out Saturday and Sunday?

2012-12-18 Thread Gabriel Pozo
Thanks Audrius, Your answer was very helpful, is exactly what I was looking. 2012/12/17 Audrius Kažukauskas audr...@neutrino.lt On Mon, 2012-12-17 at 11:54:20 -0800, Gabriel Pozo wrote: I am a new user of sqlalchemy, I need to know how I can filter the weekdays, to exclude Saturdays and