[sqlalchemy] Analogue of SQL view in SqlAlchemy

2017-01-13 Thread Stephen Davies
(Using latest SqlAlchemy with either sqlite or postgres on a Flask server) I have a table of entities and stats with columns: id, date, stat1, stat2, etc. There are a lot of endpoints on the Flask server that need to do processing on an aggregated form of the above, something like: SELECT id,

Re: [sqlalchemy] Re: Error dropping table with sequence on Postgres

2017-01-13 Thread Stéphane Raimbault
The second pattern of your mail (server side default) describes the use of the metadata argument: my_seq = Sequence('some_seq', metadata=Base.metadata) It would be great to have that information in the documentation (I spent too much time on that problem and I hope others won't). Le

Re: [sqlalchemy] Syntax for contained by DateRange

2017-01-13 Thread mike bayer
On 01/06/2017 09:48 AM, Alexander O'Donovan-Jones wrote: Does anyone know what the syntax for using DateRanges is? I'm trying to find out if a given date falls within a range, and so thought that the `in` syntax in Python might work (to no avail): from psycopg2.extras import DateRange

Re: [sqlalchemy] Re: Error dropping table with sequence on Postgres

2017-01-13 Thread mike bayer
the docs for the metadata argument are present in the constructor documentation for Sequence: http://docs.sqlalchemy.org/en/latest/core/defaults.html?highlight=sequence#sqlalchemy.schema.Sequence.params.metadata Agree adding it to