[sqlalchemy] Re: Generating INTEGER PRIMARY KEY AUTOINCREMENT column in sqlite

2009-05-19 Thread Wichert Akkerman
Previously Werner F. Bruhin wrote: Hi Leonard, paniq303 wrote: Hello, how is the progress with this feature - how can I use it? My application strongly depends on AUTOINCREMENT being available. To explain: Without AUTOINCREMENT, a deleted primary key will be reassigned.

[sqlalchemy] Re: Automatic eager loading

2009-05-19 Thread Joril
On 19 Mag, 01:03, Michael Bayer mike...@zzzcomputing.com wrote: you'd have to roll that yourself.  Its generally not feasable for   every relation on an object to be eagerloaded since it would create   too many joins. I see, I'll just choose eager loads manually depending on context then,

[sqlalchemy] Re: Multiple self-referential relations

2009-05-19 Thread Wichert Akkerman
Previously Michael Bayer wrote: On May 18, 2009, at 7:01 AM, Wichert Akkerman wrote: session = orm.relation(SurveySession, cascade=all, remote_side=[SurveySession.id], primaryjoin=SurveySession.id==TreeNode.session_id) parent = orm.relation(TreeNode,

[sqlalchemy] Querying for empty collection

2009-05-19 Thread Marcin Krol
Hello everyone, I want to find emails that have no projects added. 'projects' is an SQLA collection in Email class. So I have this: unassocusers = session.query(Email).filter(Email.projects == []).order_by(Email.email).all() And I get this: InvalidRequestError: Can't compare a collection

[sqlalchemy] Querying for empty collection

2009-05-19 Thread Marcin Krol
Hello everyone, Found it, I have to do this: unassocusers = session.query(Email).filter(Email.projects == None).order_by(Email.email).all() Sorry for wasting bandwidth.. Regards, mk --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] select

2009-05-19 Thread Tiago Becker
Hi. Im still trying to use the select object from sqlalchemy, but i found a strange (bug or not) behavior: sql = select(columns=[self.fields], from_obj=self.tables, whereclause=self.where, bind=self.req.cfg.engine, order_by= ' 1 ') 1) without order by, i get an error: AttributeError:

[sqlalchemy] Self-referential many-to-many relation

2009-05-19 Thread Marcin Krol
Hello everyone, I have a table of Features. Simple enough for basic usage, but what if I wanted Features to provide and require other Features? Akin to RedHat's RPM packages that provide and require capabilities? E.g. I would have AntiSpam feature that requires EmailServer feature and

[sqlalchemy] Re: Multiple self-referential relations

2009-05-19 Thread Michael Bayer
because SurveySession extends from TreeNode, you have to disambiguate SurveySession.id from TreeNode.id: class SurveySession(TreeNode): __tablename__ = session __mapper_args__ = dict(polymorphic_identity=session) survey_id = schema.Column('id', types.Integer(), primary_key=True,

[sqlalchemy] Re: select

2009-05-19 Thread Michael Bayer
On May 19, 2009, at 10:39 AM, Tiago Becker wrote: Hi. Im still trying to use the select object from sqlalchemy, but i found a strange (bug or not) behavior: sql = select(columns=[self.fields], from_obj=self.tables, whereclause=self.where, bind=self.req.cfg.engine, order_by= ' 1 ')

[sqlalchemy] Re: Self-referential many-to-many relation

2009-05-19 Thread Michael Bayer
On May 19, 2009, at 10:41 AM, Marcin Krol wrote: Hello everyone, I have a table of Features. Simple enough for basic usage, but what if I wanted Features to provide and require other Features? Akin to RedHat's RPM packages that provide and require capabilities? E.g. I would have

[sqlalchemy] Comparing a relation attribute with null() fails - bug or feature? (SQLAlchemy 0.5.4p1)

2009-05-19 Thread klaus
Hi! Here is a small (and not very useful) example to demonstrate the problem. A table user contains a reference to itself (so that I don't need a second table). This foreign key translates to a relation. When I compare the corresponding attribute to null(), I get a traceback. It all works if I

[sqlalchemy] Re: select

2009-05-19 Thread Tiago Becker
this indicates a None is being sent as a column somewhere. I'm just not passing the order_by clause... I dont see the SQLAlchemy expression you're dealing with here. the symptom you describe is when placing a FROM object in the columns clause of a SELECT, the object is also added to the FROM

[sqlalchemy] Re: Comparing a relation attribute with null() fails - bug or feature? (SQLAlchemy 0.5.4p1)

2009-05-19 Thread klaus
How do I get the privileges for that? On 19 Mai, 17:33, Michael Bayer mike...@zzzcomputing.com wrote: it seems like a small bug and you can file a ticket for that,  but the   intent is that you'd be using None to represent NULL in the general   case. On May 19, 2009, at 11:21 AM, klaus

[sqlalchemy] More elegant way of doing exclusion

2009-05-19 Thread Marcin Krol
Hello everyone, I have this and it works: hwrepemails = session.query(Email).join(HWRep).all() hwrepemailids = [ e.id for e in hwrepemails ] unassociatedusers = session.query(Email).filter(Email.projects == None).filter(not_(Email.id.in_(hwrepemailids))).order_by(Email.email).all() The

[sqlalchemy] Re: select

2009-05-19 Thread Michael Bayer
send along full reproducing test cases and that will reveal all. On May 19, 2009, at 11:36 AM, Tiago Becker wrote: this indicates a None is being sent as a column somewhere. I'm just not passing the order_by clause... I dont see the SQLAlchemy expression you're dealing with here. the

[sqlalchemy] Re: Comparing a relation attribute with null() fails - bug or feature? (SQLAlchemy 0.5.4p1)

2009-05-19 Thread Michael Bayer
log in as guest/guest On May 19, 2009, at 11:52 AM, klaus wrote: How do I get the privileges for that? On 19 Mai, 17:33, Michael Bayer mike...@zzzcomputing.com wrote: it seems like a small bug and you can file a ticket for that, but the intent is that you'd be using None to

[sqlalchemy] Re: More elegant way of doing exclusion

2009-05-19 Thread Michael Bayer
assuming you have a relation() from Email to HWRep: session .query(Email).filter(~Email.hwreps.any()).filter(~Email.projects.any()) On May 19, 2009, at 12:21 PM, Marcin Krol wrote: Hello everyone, I have this and it works: hwrepemails = session.query(Email).join(HWRep).all()

[sqlalchemy] Create a stored procedure using SQLAlchemy

2009-05-19 Thread Daniel
Hello, I have a stored procedure for SQL Server and I would like to be able to execute the code to create the stored procedure using SA. Here's the basic idea. engine = sqlalchemy.create_engine('mssql://connectionString') engine.execute(myStoredProcedure) Where: myStoredProcedure = PRINT

[sqlalchemy] Re: Create a stored procedure using SQLAlchemy

2009-05-19 Thread Michael Bayer
seems like a limitation of the DBAPI in use. have you tried creating a test script using just raw (pyodbc | adodbapi | pymssql) ? On May 19, 2009, at 2:23 PM, Daniel wrote: Hello, I have a stored procedure for SQL Server and I would like to be able to execute the code to create the

[sqlalchemy] changing instance identity

2009-05-19 Thread jo
Hello all, I have the following problem. While I'm working in my session, someone change my instance identity. I would like to avoid this. Is there a way to understand if was there any change before flushing? This is the message: File