Re: [sqlalchemy] Making a new type out of Postgres DATERANGE + Psycopg2 DateRange

2015-04-24 Thread Richard Gerd Kuesters
perhaps this could help you? http://sqlalchemy-utils.readthedocs.org/en/latest/range_data_types.html#datetimerangetype richard. On 04/24/2015 10:09 AM, Dimitris Theodorou wrote: Hi, I am using psycopg2 and trying to put together a new daterange type that combines the following: 1. A

Re: [sqlalchemy] Re: H2 database

2015-04-24 Thread Mike Bayer
On 4/24/15 12:06 PM, Jonathan Vanasco wrote: SqlAlchemy needs 2 things for a database work: 1. A python database driver 2. A SqlAlchemy dialect (that tells SqlAlchemy how to write sql for the driver) So... 1. H2 doesn't seem to have any Python drivers or other support. I just came

Re: [sqlalchemy] Making a new type out of Postgres DATERANGE + Psycopg2 DateRange

2015-04-24 Thread Mike Bayer
On 4/24/15 9:09 AM, Dimitris Theodorou wrote: Hi, I am using psycopg2 and trying to put together a new daterange type that combines the following: 1. A custom daterange class which provides various useful helpers (backwards/forwards iteration, intersection). 2. The psycopg2 DateRange that

[sqlalchemy] Preserving entity in a query after wrapping that query in additional select

2015-04-24 Thread Юрий Пайков
q = session.query(Recipe, func.avg(Recipe.field1).over(...)).join(...) I have a query which selects some mapped entity as well as other columns. I then refer to the name of that entity when working with the result of the query: for entry in q.all(): recipe=entry.Recipe Now, I want

[sqlalchemy] Is there a way to preserve entity after wrapping the Query in additional select?

2015-04-24 Thread Юрий Пайков
I have a query which selects an entity A and some calculated fields q = session.query(Recipe,func.avg(Recipe.somefield).join(.) I then use what I select in a way which assumes I can subscript result with Recipe string: for entry in q.all(): recipe=entry.Recipe # Access KeyedTuple by

[sqlalchemy] Declarative setup failing on upgrade to 1.0.1

2015-04-24 Thread Bill Schindler
I'm trying to upgrade from SA 0.9.8 to 1.0.1 and getting a traceback. I'm not sure what's going on here, but the declarative setup is obviously not happy with something. (On 0.9.8, everything runs fine, so I've obviously run afoul of something new/different/fixed.) File

[sqlalchemy] SQLAlchemy 1.0.2 Released

2015-04-24 Thread Mike Bayer
SQLAlchemy release 1.0.2 is now available. As additional regressions are still being reported, we would like to get these changes out as fast as possible so that early adopters are working on a 1.0 version that is most representative of what its final form will be. 1.0.2 includes two

Re: [sqlalchemy] Declarative setup failing on upgrade to 1.0.1

2015-04-24 Thread Mike Bayer
give 1.0.2 a try since we adjusted some things regarding __declare_first__ and __declare_last__. Further than that it depends a lot on what your basic Base setup looks like, mixins in use, extensions like AbstractConcreteBase, stuff like that. Any details you can share would help. On

[sqlalchemy] Re: H2 database

2015-04-24 Thread Jonathan Vanasco
SqlAlchemy needs 2 things for a database work: 1. A python database driver 2. A SqlAlchemy dialect (that tells SqlAlchemy how to write sql for the driver) So... 1. H2 doesn't seem to have any Python drivers or other support. I just came across an old forum post that talked about possibly

[sqlalchemy] H2 database

2015-04-24 Thread Cecil Westerhof
I am using the H2 database. (http://h2database.com/html/main.html) It looks like it is not possible to use this database with SQLAlchemy. Is that correct? If so: what kind of effort would it take to make SQLAlchemy work with the H2 database? Would that be something a one person team (yours truly)

Re: [sqlalchemy] Add information to reflected tables

2015-04-24 Thread Jeffrey Yan
That worked perfectly, thanks! Behaves exactly the same as if I had manually defined all the tables using declarative_base. On Friday, April 24, 2015 at 10:01:49 AM UTC+12, Michael Bayer wrote: On 4/23/15 5:15 PM, Jeffrey Yan wrote: I have a couple of tables that I want to reflect. The

[sqlalchemy] Preserve mapped entities after wrapping the query

2015-04-24 Thread Пайков Юрий
 q = session.query(Recipe, func.avg(Recipe.field1).over(...)).join(...) I have a query which selects some mapped entity as well as other columns. I then refer to the name of that entity when working with the result of the query:for entry in q.all():  recipe=entry.Recipe   Now, I want to add

Re: [sqlalchemy] Preserve mapped entities after wrapping the query

2015-04-24 Thread Mike Bayer
On 4/24/15 5:25 PM, Пайков Юрий wrote: q = session.query(Recipe, func.avg(Recipe.field1).over(...)).join(...) I have a query which selects some mapped entity as well as other columns. I then refer to the name of that entity when working with the result of the query: for entry in q.all():