[sqlalchemy] Declarative: defining relationship and column in one line

2015-05-19 Thread Paul Johnston
Hi, Sorry if this is a FAQ, but is it possible to define a relationship and its column all at once. e.g. instead of: type_id = db.Column(db.Integer, db.ForeignKey('linktype.id')) type = db.relationship('LinkType') Something like: type = db.relationship('LinkType',

Re: [sqlalchemy] Build With Different Backends [RESOLVED]

2015-05-19 Thread Rich Shepard
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tue, 19 May 2015, Mike Bayer wrote: Examples: date and time functions are entirely different on both platforms, schema migration operations e.g. ALTER are generally not supported on SQLite, SQLite has very different behavior regarding foreign

Re: [sqlalchemy] Build With Different Backends

2015-05-19 Thread Mike Bayer
On 5/19/15 1:51 PM, Rich Shepard wrote: I thought there was a thread on this but I cannot find it so please point me to that thread if it exists. An application will be provided in two versions: a single-user version with SQLite3 as the backend, and a multi-user version with PostgreSQL

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Mike Bayer
On 5/19/15 8:57 AM, Richard Gerd Kuesters wrote: hi! this may be a weird question, but is there a way i can restrict the number of children in a relationship? not by limit ... how is that different? Anytime in SQL you want to get only the first N of M, LIMIT or its equivalents must be

Re: [sqlalchemy] Declarative: defining relationship and column in one line

2015-05-19 Thread Mike Bayer
On 5/19/15 6:54 AM, Paul Johnston wrote: Hi, Sorry if this is a FAQ, but is it possible to define a relationship and its column all at once. e.g. instead of: type_id = db.Column(db.Integer, db.ForeignKey('linktype.id')) type = db.relationship('LinkType') Something like: type

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
thanks Mike! when i stated about the limit, it was because it must not be taken as a parameter for any query, which select * from blah and select * from bla limit N should be return the same exactly number of rows, including where filters and so on. it is something like a physical rule, where

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Mike Bayer
On 5/19/15 10:54 AM, Richard Gerd Kuesters wrote: thanks Mike! when i stated about the limit, it was because it must not be taken as a parameter for any query, which select * from blah and select * from bla limit N should be return the same exactly number of rows, including where filters

Re: [sqlalchemy] Re: restrict child count?

2015-05-19 Thread Mike Bayer
On 5/19/15 12:18 PM, Jonathan Vanasco wrote: I think I might understand you... You have a BOX, which could be a variable amount of sizes, and each size can hold a variable amount of items. You want to create a rule(s) that will ensure you do not have too many things in each box. If that

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
bingo! thanks Simon. that's exactly the question :) well, the checks on the cube are already there (they must have a value higher then 0 to have a volume), but i must not increment the cube children more then it's maximum capacity. i'm considering an event listener as well, but i'm wondering

[sqlalchemy] restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
hi! this may be a weird question, but is there a way i can restrict the number of children in a relationship? not by limit ... scenario: i have a one to many rel, where the parent have 3 values (row, column, depth) that creates a max child count of row * column * depth (yes, like the 3d

Re: [sqlalchemy] Re: restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
i know, i'm sorry for that. i first posted it here since my whole application is managed by sqlalchemy, so that's why i asked for something. i mentioned postgresql because it's the database that i use and there's a lot of database specific solutions bundled with sa. but, even if no rdbms

[sqlalchemy] MariaDB and SQLAlchemy

2015-05-19 Thread Margaret Tilton
Hello, If there is documentation on this that I missed, please let me know. I have code that worked fine when I was using a MySQL database. My organization has switched to using MariaDB, which I was told was virtually identical to MySQL. It seems can connect to a MariaDB db using the

Re: [sqlalchemy] MariaDB and SQLAlchemy

2015-05-19 Thread Mike Bayer
On 5/19/15 6:53 PM, Margaret Tilton wrote: Hello, If there is documentation on this that I missed, please let me know. I have code that worked fine when I was using a MySQL database. My organization has switched to using MariaDB, which I was told was virtually identical to MySQL. It seems

[sqlalchemy] Re: restrict child count?

2015-05-19 Thread Jonathan Vanasco
I think I might understand you... You have a BOX, which could be a variable amount of sizes, and each size can hold a variable amount of items. You want to create a rule(s) that will ensure you do not have too many things in each box. If that is that case: 1. You could use Triggers in

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Simon King
On Tue, May 19, 2015 at 4:06 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 5/19/15 10:54 AM, Richard Gerd Kuesters wrote: thanks Mike! when i stated about the limit, it was because it must not be taken as a parameter for any query, which select * from blah and select * from bla limit

[sqlalchemy] Build With Different Backends

2015-05-19 Thread Rich Shepard
I thought there was a thread on this but I cannot find it so please point me to that thread if it exists. An application will be provided in two versions: a single-user version with SQLite3 as the backend, and a multi-user version with PostgreSQL as the backend. Am I correct that the only