[sqlalchemy] Deprecation of the objects argument to session.flush()

2009-08-21 Thread alex
Hi, all! I use just one session in my project. Objects (loaded from the database) can changed by user while the program in progress. But only some of them should be saved. Usually I use session.flush (selected_objects), but now this opportunity is deprecated :( Please help me to find a solution

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
i want to add a composite index to the class inherited from declarative_base I tried this, class MyClass: __tablename__ = 'my_table' id = Column(Integer, primary_key=True) name = Column(String, nullable=False) type = Column(String, nullable=False) __table_args__ = (

[sqlalchemy] Re: new questions

2009-08-21 Thread darkblueB
On Aug 19, 2:27 am, King Simon-NFHD78 simon.k...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of darkblueB Sent: 19 August 2009 02:58 To: sqlalchemy Subject: [sqlalchemy] Re: new questions Hi Simon

[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: table creation oddity

2009-08-21 Thread King Simon-NFHD78
Faheem Mitha wrote: Hi, The following script is then followed by its output, and finally by the table output. I don't get what is going on here. Yes, I should commit the session, and the table is empty as expected, but why does the id keep incrementing on successive runs, and

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
hi thanks for the reply.. but one doubt how will i access the MyClass inside MyClass i tried ndex('ix_name_type', MyClass.__table__.c.name,MyClass.__table__.c.type, unique=True) it is giving the error NameError: name 'MyClass' is not defined thanks On Aug 21, 2:04 pm, King Simon-NFHD78

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
i tried class MyClass: __tablename__ = 'my_table' id = Column(Integer, primary_key=True) name = Column(String, nullable=False) type = Column(String, nullable=False) __table_args__ = ( Index('ix_name_type', name , type ,unique=True) ) it errors out

[sqlalchemy] Re: index in SA

2009-08-21 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 10:25 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA i tried class MyClass: __tablename__ = 'my_table' id =

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
exactly On Aug 21, 2:33 pm, King Simon-NFHD78 simon.k...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 10:25 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA

[sqlalchemy] Re: ORM query with overlaps operator

2009-08-21 Thread Ants Aasma
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 that it doesn't break when changing versions.

[sqlalchemy] Re: table creation oddity

2009-08-21 Thread Faheem Mitha
On Fri, 21 Aug 2009, King Simon-NFHD78 wrote: I've never used postgres, but I believe auto-incrementing counters are implemented using database sequences. I think these are incremented outside of a transaction - this ensures that two seperate database connections using the sequence at

[sqlalchemy] Re: table creation oddity

2009-08-21 Thread King Simon-NFHD78
Faheem Mitha wrote: Thanks for the fast and helpful response. This looks like an artifact of how I am creating the table. I wonder if this would still show up if I explicitly specified the id. I could check this. Also, presumably if I had other cols in the table, they wouldn't show up in

[sqlalchemy] Re: interpret (string) NULLs as empty strings, not None

2009-08-21 Thread Catherine Devlin
On Thu, Aug 6, 2009 at 3:14 PM, Michael Bayermike...@zzzcomputing.com wrote: When populating objects through the ORM, I'd like to interpret all NULL values fetched from VARCHAR2 / NVARCHAR2 columns in the database as empty strings ('') instead of `None`s. use a TypeDecorator that creates

[sqlalchemy] Re: new questions

2009-08-21 Thread darkblueB
On Aug 21, 2:17 am, King Simon-NFHD78 simon.k...@motorola.com wrote: darkblueB wrote: ok, I have done this I have an object def and a __table__ for all of the main actors in my setup I defined an __init__() for one of them I use the declarative base when the objects get created,

[sqlalchemy] Re: table creation oddity

2009-08-21 Thread Faheem Mitha
Hi Simon, On Fri, 21 Aug 2009, King Simon-NFHD78 wrote: Faheem Mitha wrote: Thanks for the fast and helpful response. This looks like an artifact of how I am creating the table. I wonder if this would still show up if I explicitly specified the id. I could check this. Also, presumably

[sqlalchemy] Re: new questions

2009-08-21 Thread Mike Conley
but I thought somehow that meta.reflect() would pick up on the fk constraints ... Class MetaData is part of the core api that ORM builds on top of, and meta.reflect() does pick up the fk constraints from the database. Think of it this way, MetaData, whether reflected or declared in its

[sqlalchemy] Database with audit trail table

2009-08-21 Thread Adrian von Bidder
Heyho! Instead of creating changeby / changed fields on all my tables, I'm planning to write some model classes where changes would be recorded in a separate audit trail table (the obvious benefit beyond not requiring the additional fields is that I can preserve the history as far back as I

[sqlalchemy] Re: Database with audit trail table

2009-08-21 Thread Mike Conley
You might want to start here http://www.sqlalchemy.org/trac/wiki/UsageRecipes/LogVersions --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[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,