[sqlalchemy] Re: PostgreSQL: interval columns, values measured in months or years

2013-12-25 Thread David Bolen
Wichert Akkerman wich...@wiggy.net writes: How does your code differ from https://pypi.python.org/pypi/psycopg2-dateutils ? Ah, I skipped that second URL earlier and only looked through the SO discussion... I guess two major differences I see are that psycopg2-dateutils appears to only

[sqlalchemy] Re: PostgreSQL: interval columns, values measured in months or years

2013-12-24 Thread David Bolen
Sibylle Koczian nulla.epist...@web.de writes: Exactly, that's it. The stackoverflow discussion was very instructive, thank you! I'll try out psycopg2-dateutils. I'm a big fan of dateutil. If you do use it, you may also choose to bypass the use of timedelta entirely, since as you've seen it

[sqlalchemy] Re: how can i generate IS NOT True instead of != True ( orm ) ?

2012-08-10 Thread David Bolen
Jonathan Vanasco jonat...@findmeon.com writes: in postgresql i have a boolean field that allows Null values. i'd like to query for the items that are not 'true' filter( tablename.is_deleted != True ) creates this sql: is_deleted != True however this is incorrect and doesn't match

[sqlalchemy] Re: The Minimalists' strategy for SQLAlchemy.

2011-04-30 Thread David Bolen
Kuze kuze.to...@gmail.com writes: I'm also aware of `reflection` capability provided. However, it'd be hitting the database with a query to grab the necessary data points for generating the schema. For production, hitting the db when using reflection does not sound compelling. With my

[sqlalchemy] Parameters lost when working with multiple query objects

2010-03-03 Thread David Bolen
I ran into a small problem attempting to union two existing Query instances together, where one that was using some custom parameters seemed to lose the parameter information when incorporated into a higher level query making use of from_statement. This is with SA 0.5.8. Given these two starting

[sqlalchemy] Correlated sub-query as ORM query filter

2010-02-23 Thread David Bolen
Hopefully this won't just be a section in the manual I missed, but I'm having some difficulties constructing an ORM query while using correlated sub-queries within filter(). This is with SA 0.5.8. Given the following tables (with just the relevant columns shown): attendance (

[sqlalchemy] Re: Correlated sub-query as ORM query filter

2010-02-23 Thread David Bolen
Michael Bayer mike...@zzzcomputing.com writes: if the issue is that you have a query(), and you like to say somequery.filter(q == x), you'd turn query() into a subquery (i.e. an alisaed SQLAlchemy expression object) using q.subquery(), and then into a scalar subquery using as_scalar(), which

[sqlalchemy] Re: Reflected Tables and Session [and how to bind]

2010-02-13 Thread David Bolen
Rob robert.sudwa...@googlemail.com writes: However, importing [or trying to instantiate this class] will fail until the connection is in place ie the class as it stands cannot be called until a valid engine is bound. I'm guessing that something will need to be passed to an __init__ in the

[sqlalchemy] Re: David Bolen on SA and Twisted

2009-10-23 Thread David Bolen
Don Dwiggins d...@dondwiggins.net writes: Hmmm, Could you elaborate a bit about the self-contained? I do have some cases where I fire off a deferredList with several (independent) queries in it. Might that be problematic? My guess is that your independent comment is essentially the same

[sqlalchemy] Re: David Bolen on SA and Twisted

2009-10-22 Thread David Bolen
Don Dwiggins d...@dondwiggins.net writes: Doing some exploration on the intersection of Twisted and SA, I came across a message by David Bolen in February of 2007, describing a simple database class that contained a background thread for execution. I'd like to know if that work, or some

[sqlalchemy] ORM query with overlaps operator

2009-08-21 Thread David Bolen
Has anyone generated ORM queries using the OVERLAPS SQL operator that reference columns in the tables in the query? I've been experimenting with various approaches and can't seem to cleanly get the column names (with their appropriate alias based on the rest of the query) into the overlaps

[sqlalchemy] Re: ORM query with overlaps operator

2009-08-21 Thread David Bolen
Ants Aasma ants.aa...@gmail.com writes: This is something that could be improved in SQLAlchemy, but as a workaround you can use the compiler extension to create the support yourself. Here's some example code. It uses some private internals from SQLAlchemy so you need to keep an eye on it

[sqlalchemy] Re: Database with audit trail table

2009-08-21 Thread David Bolen
Adrian von Bidder avbid...@fortytwo.ch writes: Ideas comments? For what it's worth, I'd think that the best sort of audit would be something done in the database itself, since it would audit any changes whether done through any interface. It depends on the database involved, but for example,

[sqlalchemy] Sharing join between main query and eagerload

2009-08-14 Thread David Bolen
This feels like something that I ought to be able to find already answered somewhere but I've been searching the archives and the documentation and haven't been able to discover it. Is it possible to construct an ORM query that includes eagerloaded related objects such that the outer joins due

[sqlalchemy] Re: Sharing join between main query and eagerload

2009-08-14 Thread David Bolen
Michael Bayer mike...@zzzcomputing.com writes: http://www.sqlalchemy.org/docs/05/mappers.html?highlight=contains_eager#routing-explicit-joins-statements-into-eagerly-loaded-collections Ok, that's embarrassing... I even recall skimming that section, but now looking at it can't for the life of

[sqlalchemy] Re: whats going to break in 0.4

2007-07-03 Thread David Bolen
Michael Bayer [EMAIL PROTECTED] writes: 4. global_connect() / default_metadata (...) (...) Plus it used DynamicMetaData which is a totally misunderstood object that isnt going away but will be much more downplayed. youre responsible for your own MetaData

[sqlalchemy] Re: whats going to break in 0.4

2007-07-03 Thread David Bolen
jason kirtland [EMAIL PROTECTED] writes: DynamicMetaData is not deprecated, but it may be renamed in 0.4 to clarify its role. For this setup, a MetaData will suffice- it is dynamic as in late binding and re-bindable. After you get your engine sorted out, you can connect() the engine and

[sqlalchemy] Deleting single association in many-to-many relationship

2007-06-13 Thread David Bolen
This seems like it would be a very common scenario, but it's got me stumped and feeling a bit stupid at the moment - I would appreciate anyone helping to point me in the right direction. I'm using the ORM for a many-to-many relationship, for which over time I need to be able to prune individual

[sqlalchemy] Re: Deleting single association in many-to-many relationship

2007-06-13 Thread David Bolen
Michael Bayer [EMAIL PROTECTED] writes: On Jun 13, 2007, at 6:13 AM, David Bolen wrote: * I want to remove the association between File Common and Job 1 but without affecting Job 2. If I session.delete() the fc instance directly, SA purges the file completely, including links

[sqlalchemy] Erroneous primary key of in-memory instance after session flush?

2007-06-12 Thread David Bolen
I was converting an older table definition from using an integer primary key to a string (representation of UUID), and ran into a bit of strange behavior, where my object instance's String primary key receives an integer value (which appears to be the internal sqlite rowid) after a flush. From

[sqlalchemy] Session allocation and (non) thread safety

2007-04-08 Thread David Bolen
The Session object clearly isn't thread-safe, which is fine, but I was curious if the intention is for that to also include its initial allocation? That is, I'd like to potentially allocate a new Session object in thread A, but any and all operations on the object aside from the instantiation

[sqlalchemy] Re: Asynchronous SQLAlchemy--Anybody using Twisted, sAsync?

2007-02-20 Thread David Bolen
Matt Culbreth [EMAIL PROTECTED] writes: I'm playing out with a few things now and I wanted to see if anyone else has used SQLAlchemy in an asynchronous manner? For example, you could create a service which responded to asynchronous requests for data, and could be used by a web client,