[sqlalchemy] Get statement from Select object..

2010-01-18 Thread Kalium
Hi, >From what I can tell sqla (version 0.4) doesn't support this? I know I can access 'statement' from a Query object, but I'm using a select object. I'm trying to do this because I'm trying to create a view table like this eng.execute("CREATE VIEW foobar AS %s" % someselect.compile(eng)) My se

Re: [sqlalchemy] Mixed inheritance mapping and multiple binds

2010-01-18 Thread Michael Bayer
On Jan 18, 2010, at 6:27 PM, Ross Vandegrift wrote: > > Shouldn't this work on SA 0.5.8? > > engine = create_engine('sqlite:///:memory:', echo=True) > metadata.create_all(engine) > binds = { device_table : engine, > switch_table : engine } > Currently its looking at the mapped table

[sqlalchemy] Re: Name clash in SqlSoup

2010-01-18 Thread PauloS
On 18 jan, 19:30, Michael Bayer wrote: > ... > > How was that fixed in trunk, the atribute was renamed to _query or > > something like that? > > it was actually always there as _query for internal use.     the "query" was > coming from the usage of Session.mapper, which it no longer uses. > Mike

[sqlalchemy] Mixed inheritance mapping and multiple binds

2010-01-18 Thread Ross Vandegrift
Hello, I've run into a case where my code works with a single engine binding but breaks if bound to multiple engines. I'm doing some things that might be considered weird - mixing joined and single table inheritance to reduce data storage, inheriting mappers from other derived mappers. The except

Re: [sqlalchemy] Re: Name clash in SqlSoup

2010-01-18 Thread Michael Bayer
On Jan 18, 2010, at 3:35 PM, PauloS wrote: > On Jan 16, 4:06 pm, Michael Bayer wrote: >> OK SQLSoup is using the Session.extension which adds a ".query" attribute >> unconditionally. this bug is fixed in trunk. I can't do it in 0.5 since >> .query is a public API that people might be relyi

[sqlalchemy] Re: Name clash in SqlSoup

2010-01-18 Thread PauloS
On Jan 16, 4:06 pm, Michael Bayer wrote: > OK SQLSoup is using the Session.extension which adds a ".query" attribute > unconditionally.   this bug is fixed in trunk.   I can't do it in 0.5 since > .query is a public API that people might be relying upon.   To work around in > 0.5 do: > > sqlsou

Re: [sqlalchemy] Doubt about UnicodeText

2010-01-18 Thread Michael Bayer
On Jan 18, 2010, at 10:00 AM, Tomas Zulberti wrote: > Hi. I have the following error while making a query using the models: >raise exc.DBAPIError.instance(statement, parameters, e, > connection_invalidated=is_disconnect) > ProgrammingError: (ProgrammingError) can't adapt > 'UPDATE data_items

[sqlalchemy] Doubt about UnicodeText

2010-01-18 Thread Tomas Zulberti
Hi. I have the following error while making a query using the models: raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect) ProgrammingError: (ProgrammingError) can't adapt 'UPDATE data_items SET content=%(content)s WHERE data_items.serial_id = %(data_ite

[sqlalchemy] Re: how to get data type that InstrumentedAttribute expects

2010-01-18 Thread Kent
Thank you. On Jan 18, 9:41 am, Michael Bayer wrote: > On Jan 18, 2010, at 7:33 AM, Kent wrote: > > > Given an InstrumentedAttribute object, how can you determine which > > data type (int, str, datetime, etc) that the attribute expects to > > house? > > > Thanks in advance if anyone can answer thi

[sqlalchemy] Re: Column property vs. Python (class) property for calculated columns

2010-01-18 Thread avdd
Here's my reworking of the example for time types: """ from datetime import datetime, timedelta, date from sqlalchemy import MetaData, Table, Column, DateTime, Date, Interval from sqlalchemy.orm import mapper, create_session metadata = MetaData('postgresql:///avdd') interval_table1 = Table('peri

Re: [sqlalchemy] how to get data type that InstrumentedAttribute expects

2010-01-18 Thread Michael Bayer
On Jan 18, 2010, at 7:33 AM, Kent wrote: > Given an InstrumentedAttribute object, how can you determine which > data type (int, str, datetime, etc) that the attribute expects to > house? > > Thanks in advance if anyone can answer this. for a column-based attribute you can get at the column and

[sqlalchemy] how to get data type that InstrumentedAttribute expects

2010-01-18 Thread Kent
Given an InstrumentedAttribute object, how can you determine which data type (int, str, datetime, etc) that the attribute expects to house? Thanks in advance if anyone can answer this. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to thi

[sqlalchemy] Re: Column property vs. Python (class) property for calculated columns

2010-01-18 Thread bojanb
> > However, I have issues with the difference in NULL value semantics > > between Python and SQL. Ie. if a calculated column is defined via a > > column_property as price*amount, then the result will be NULL if any > > of the values is NULL. However, in Python, None*something throws a > > TypeErro

[sqlalchemy] Re: Mapping an object to multiple tables

2010-01-18 Thread bojanb
This can be done and it's not too complicated, but beware as in 95% of the time it's a deficency in your model; ie. you can refactor your model so that you don't need this. If it's the other 5% of cases, here's what the code looks like (I can't honestly remember if I read this in the docs or got i