Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Adrian Schreyer
I actually I just found the problem; the tables are in fact created in the right order - the problem is that the DDL contains INHERITS ( "parent" ). It gives the same error if I try to run the code in a GUI with the inherited table name quoted, without (the quoting) though it works. On Mon, Nov

[sqlalchemy] Creating PostgreSQL Index with ASC/DESC and NULLS FIRST/LAST

2015-11-23 Thread Florian Rüchel
Hey, I want to execute the following statement in the most SQLAlchemy way possible: CREATE INDEX ix_user_points ON "user" (points DESC NULLS LAST); So I want to add a "DESC NULLS LAST" or equivalent as per documentation (http://www.postgresql.org/docs/current/static/indexes-ordering.html)

Re: [sqlalchemy] Creating PostgreSQL Index with ASC/DESC and NULLS FIRST/LAST

2015-11-23 Thread Mike Bayer
On 11/23/2015 03:01 PM, Florian Rüchel wrote: > Hey, > > I want to execute the following statement in the most SQLAlchemy way > possible: > > CREATE INDEX ix_user_points ON "user" (points DESC NULLS LAST); > > So I want to add a "DESC NULLS LAST" or equivalent as per documentation >

Re: [sqlalchemy] Creating PostgreSQL Index with ASC/DESC and NULLS FIRST/LAST

2015-11-23 Thread Florian Rüchel
Thanks! On 11/23/2015 09:06 PM, Mike Bayer wrote: > > On 11/23/2015 03:01 PM, Florian Rüchel wrote: >> Hey, >> >> I want to execute the following statement in the most SQLAlchemy way >> possible: >> >> CREATE INDEX ix_user_points ON "user" (points DESC NULLS LAST); >> >> So I want to add a "DESC

Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Adrian
I attached a script that reproduces the problem. It actually only happens if the metadata contains a schema, then the tablename in the INHERITS() clause get quoted, which causes the problem. On Monday, November 23, 2015 at 7:13:27 PM UTC+1, Adrian wrote: > > I actually I just found the problem;

Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Mike Bayer
On 11/23/2015 03:15 PM, Adrian wrote: > I attached a script that reproduces the problem. It actually only > happens if the metadata contains a schema, then the tablename in the > INHERITS() clause get quoted, which causes the problem. > postgresql_inherits was only added in 1.0.How can

Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Adrian Schreyer
That's true now that you are saying it, I actually implemented it myself before using a simple @compiles with CreateTable. On Mon, Nov 23, 2015 at 9:33 PM Mike Bayer wrote: > > > On 11/23/2015 03:15 PM, Adrian wrote: > > I attached a script that reproduces the problem.

Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Mike Bayer
On 11/23/2015 03:15 PM, Adrian wrote: > I attached a script that reproduces the problem. It actually only > happens if the metadata contains a schema, then the tablename in the > INHERITS() clause get quoted, which causes the problem. anyway, there's no direct "postgresql_inherits_schema"

Re: [sqlalchemy] (OperationalError) no such column when child class uses different name for primary key in polymorphic relationship and a subselect issued

2015-11-23 Thread Martin Pengelly-Phillips
Thanks Michael. On Saturday, 21 November 2015 22:35:14 UTC, Michael Bayer wrote: > > > > On 11/20/2015 12:20 PM, Martin Pengelly-Phillips wrote: > > Hi there, > > > > Using SQLAlchemy 1.0.9 > > > > I am dealing with some legacy code and came across the following issue. > > It appears that

[sqlalchemy] Creating a derived class object without inserting into base class table

2015-11-23 Thread amit geron
Hi, I am using the flask-sqlalchemy extension with MySQL (default configuration), and I have a structure similar to the following example: class User(db.Model): id = db.Column(db.Integer, primary_key=True) def __init__(self): return class A(User): id =

[sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Adrian
Hello, I have the following problem - I recently upgraded to the 1.0+ branch from 0.9 and now the PostgreSQL table inheritance does not work properly any longer because the tables that inherit from the master table are sometimes created before (random) the actual table they inherit from,

Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Mike Bayer
On 11/23/2015 12:43 PM, Adrian wrote: > Hello, > > I have the following problem - I recently upgraded to the 1.0+ branch > from 0.9 and now the PostgreSQL table inheritance does not work properly > any longer because the tables that inherit from the master table are > sometimes created before

[sqlalchemy] new object using a dictionary as the parameter

2015-11-23 Thread mzagrabe
Greetings, I'm new to SQLAlchemy - sorry if the answer to this question is obvious. I have a table with many fields. I've created the ORM mapping: Base = declarative_base() class CallRecord(Base): [stuff] I'd like to create the CallRecord object by passing a dictionary to the constructor. Is

Re: [sqlalchemy] PostgreSQL table inheritance with "postgresql_inherits" does not take "add_is_dependent_on" into account

2015-11-23 Thread Adrian Schreyer
That works and solves it, thanks! On Mon, Nov 23, 2015 at 9:37 PM Mike Bayer wrote: > > > On 11/23/2015 03:15 PM, Adrian wrote: > > I attached a script that reproduces the problem. It actually only > > happens if the metadata contains a schema, then the tablename in

Re: [sqlalchemy] new object using a dictionary as the parameter

2015-11-23 Thread Simon King
> On 23 Nov 2015, at 17:58, mzagr...@d.umn.edu wrote: > > Greetings, > > I'm new to SQLAlchemy - sorry if the answer to this question is obvious. > > I have a table with many fields. > > I've created the ORM mapping: > > Base = declarative_base() > class CallRecord(Base): > [stuff] > > I'd