Re: [sqlalchemy] Cannot generate models for sqlite db that uses sequence for PK

2018-09-13 Thread Mike Bayer
On Thu, Sep 13, 2018 at 1:03 PM, Mark Aquino wrote: > Took me a little while to figure out what was going on, but it seems the > code breaks when you try to use a primary key column that uses a sequence in > sqlite, > > e.g. if my schema is this: > > > create table if not exists generic_sequence (

[sqlalchemy] Controlling table dependency for flushing

2018-09-13 Thread Alex Rothberg
Is it possible to hint at sqla the order in which it should write out changes to the DB? I am having issues in which I add two new objects to a session, a and b where a depends on b, but sqla is flushing a before b leading to an fk issue. I can solve this a few ways: explicitly calling flush af

[sqlalchemy] Cannot generate models for sqlite db that uses sequence for PK

2018-09-13 Thread Mark Aquino
Took me a little while to figure out what was going on, but it seems the code breaks when you try to use a primary key column that uses a sequence in sqlite, e.g. if my schema is this: create table if not exists generic_sequence ( id integer primary key *autoincrement*, visible_id integer, ali

Re: [sqlalchemy] Re: Hybrid Property vs Hybrid Method Expression Names

2018-09-13 Thread Mike Bayer
On Thu, Sep 13, 2018 at 7:55 AM, wrote: > Update: I have just found > http://docs.sqlalchemy.org/en/latest/changelog/migration_12.html#hybrid-attributes-support-reuse-among-subclasses-redefinition-of-getter > which documents that getters and setters must have the same name as the > original expre

[sqlalchemy] Re: Hybrid Property vs Hybrid Method Expression Names

2018-09-13 Thread james
Update: I have just found http://docs.sqlalchemy.org/en/latest/changelog/migration_12.html#hybrid-attributes-support-reuse-among-subclasses-redefinition-of-getter which documents that getters and setters must have the same name as the original expression. Can I just check that it is expected f

[sqlalchemy] Hybrid Property vs Hybrid Method Expression Names

2018-09-13 Thread james
Hi, I've been adding a hybrid property to a model as per the documentation at http://docs.sqlalchemy.org/en/latest/orm/extensions/hybrid.html. In particular, the behavior is complicated enough that I need to define the expression version of the property separate from the normal version. My mod

Re: [sqlalchemy] Delete, bulk delete, and Sessions—some clarification needed.

2018-09-13 Thread Simon King
On Thu, Sep 13, 2018 at 10:45 AM wrote: > > Hello, > > I’d like to get some clarification on the following two code examples. First, > bulk delete an object: > > >>> u = dbsession.query(User).first() > >>> u.id > '0078ccdf7db046179c59bff01199c25e' > >>> dbsession.query(User).filter(User.id == >

[sqlalchemy] Delete, bulk delete, and Sessions—some clarification needed.

2018-09-13 Thread jens . troeger
Hello, I’d like to get some clarification on the following two code examples. First, bulk delete an object: >>> u = dbsession.query(User).first() >>> u.id '0078ccdf7db046179c59bff01199c25e' >>> dbsession.q