[sqlalchemy] Re: Missing UPDATE on Parent

2009-02-10 Thread Massimo Bonvicini
I found that setting: def scan(self): if self.isAlive(): self.scantime = datetime.now() Explicit call to update the record It works and update the record field.

[sqlalchemy] Re: BUG: autoload for DateTime in SQL Server 2000 fails

2009-02-10 Thread Eric R. Palakovich Carr
Ah, serves me right for not checking for the latest version first. Thanks! On Feb 9, 8:00 pm, Michael Trier mtr...@gmail.com wrote: On Mon, Feb 9, 2009 at 7:56 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Feb 9, 2009, at 5:41 PM, Eric R. Palakovich Carr wrote: Is this a real bug

[sqlalchemy] join or filter, i could't join this two queries!

2009-02-10 Thread ibrahim . z . hidir
join or filter, i could't join this two queries! mevcutDonem = session.query( Donem ).filter( Donem.donem_id == func.max( Donem.donem_id ).select() ).one() konuBirimleriIds = session.query ( DonemBirimKonuMaxSayi.birim_id ).filter( and_ (DonemBirimKonuMaxSayi.konu_id ==

[sqlalchemy] Re: join or filter, i could't join this two queries!

2009-02-10 Thread Michael Bayer
call subquery() on konuBirimleriIds and use the .c. attribute on the resulting selectable to locate columns with which to join from. technique is identical to the example here: http://www.sqlalchemy.org/docs/05/ormtutorial.html#using-subqueries ibrahim.z.hi...@gmail.com wrote: join or

[sqlalchemy] Re: join or filter, i could't join this two queries!

2009-02-10 Thread ibrahim . z . hidir
konuBirimleriIds = session.query ( DonemBirimKonuMaxSayi.birim_id ).filter( and_ (DonemBirimKonuMaxSayi.konu_id == evrak.sayi.konu_id, DonemBirimKonuMaxSayi.donem_id == mevcutDonem.donem_id ) ).subquery() konuBirimleri= session.query( Birim ).filter( and_ (Birim.parent_birim_id == 1,

[sqlalchemy] Determining postgres sequence name for a table

2009-02-10 Thread Dusty Phillips
Hi there, I'm accessing a postgres database and would like to use the session.execute(Sequence('sequence_name')) syntax to get the next id for a table without actually saving the table. This all works fine if I know the sequence_name, but I was hoping to write generic code. Is it possible, using

[sqlalchemy] Re: Determining postgres sequence name for a table

2009-02-10 Thread Michael Bayer
table reflection does get a value for sequence defaults in PG, and SQLA then knows how to execute the sequence. there is an issue specifically when the sequence name has been changed in that PG no longer provides consistent access to the sequence name (theres a trac ticket for that issue), but

[sqlalchemy] altering tables

2009-02-10 Thread mhearne808[insert-at-sign-here]gmail[insert-dot-here]com
Let's say I create a table with metadata using something like the following: metadata = MetaData() self.address_table = Table('address', metadata, Column('id', Integer, primary_key=True), Column('email', String

[sqlalchemy] resultset print keys values

2009-02-10 Thread Lukasz Szybalski
Hello, Could somebody tell me how can I print the object data in my result set without knowing the column names? myresult=session.query(...).all() for i in myresult: print I need to debug some data and its hard to print the object keys and values (column names and its

[sqlalchemy] Re: resultset print keys values

2009-02-10 Thread az
object-query or plain query? - objects are .. whatever class it is; print the i.__dict__ or str(i) or whatever - plain-sql-query ones are RowProxy, they have i.keys() i.items() i.values() On Tuesday 10 February 2009 21:27:09 Lukasz Szybalski wrote: Hello, Could somebody tell me how

[sqlalchemy] Re: resultset print keys values

2009-02-10 Thread Lukasz Szybalski
On Tue, Feb 10, 2009 at 1:32 PM, a...@svilendobrev.com wrote: object-query or plain query? - objects are .. whatever class it is; print the i.__dict__ or str(i) or whatever - plain-sql-query ones are RowProxy, they have i.keys() i.items() i.values() i.__dict__ it is... Thanks a

[sqlalchemy] Re: resultset print keys values

2009-02-10 Thread Michael Bayer
dir(instance) is preferable to __dict__.keys() - the latter will not give you deferred attributes, unloaded collections, or the expired version of each of those. dir() respects descriptors basically. Lukasz Szybalski wrote: Hello, Could somebody tell me how can I print the object data in my

[sqlalchemy] Re: resultset print keys values

2009-02-10 Thread Lukasz Szybalski
On Tue, Feb 10, 2009 at 1:52 PM, Michael Bayer mike...@zzzcomputing.com wrote: dir(instance) is preferable to __dict__.keys() - the latter will not give you deferred attributes, unloaded collections, or the expired version of each of those. dir() respects descriptors basically. but then

[sqlalchemy] referencing table in other databases inside a MSSQL server

2009-02-10 Thread nosklo
Hi all! I have a MSSQL SERVER I want to use sqlalchemy on, because there are some old databases in there and legacy applications and we can't migrate the data for now. (although a migration is planned and SQLAlchemy is helping a lot) The server has two Databases (table collections) lets call

[sqlalchemy] Unable to model cross relations (using ext.declarative)

2009-02-10 Thread Bruce van der Kooij
Hi, this is probably extremely easy but I've only recently started using SQLAlchemy and I simply cannot manage to model the following relations: +--+ ++ | NodeRevision | | Node | +--+ 1 ++ | vid

[sqlalchemy] Re: Unable to model cross relations (using ext.declarative)

2009-02-10 Thread Michael Bayer
since you are modeling a parent object with many children, but also with a separate many-to-one from the parent to exactly one of those children, you need to have a foreign key in both the node and noderevision table, each referencing the other table's primary key. You then build

[sqlalchemy] Re: referencing table in other databases inside a MSSQL server

2009-02-10 Thread Michael Bayer
On Feb 10, 2009, at 3:20 PM, nosklo wrote: Hi all! I have a MSSQL SERVER I want to use sqlalchemy on, because there are some old databases in there and legacy applications and we can't migrate the data for now. (although a migration is planned and SQLAlchemy is helping a lot) The

[sqlalchemy] Re: resultset print keys values

2009-02-10 Thread Michael Trier
Hi, On Tue, Feb 10, 2009 at 3:18 PM, Lukasz Szybalski szybal...@gmail.comwrote: On Tue, Feb 10, 2009 at 1:52 PM, Michael Bayer mike...@zzzcomputing.com wrote: dir(instance) is preferable to __dict__.keys() - the latter will not give you deferred attributes, unloaded collections, or the