[sqlalchemy] Re: Advice: Best practice for working with an existing database

2013-04-04 Thread Waldemar Osuch
On Monday, March 18, 2013 3:25:36 PM UTC-6, Peter Herndon wrote: > > Hi all, > > I'm new to SQLAlchemy, and looking for some advice on how to approach > working with an existing database. > My preferred approach is to use http://code.google.com/p/sqlautocode/ and generate a module describing

[sqlalchemy] Alembic 0.5.0 Released

2013-04-04 Thread Michael Bayer
Hey gang - Alembic 0.5.0 is now available. We've accumulated a significant bunch of bug fixes and new features, quite a few of which were contributed via pull requests. Thanks to all involved to get this release packed with a lot of new stuff. With version 0.5, we've dropped support for SQ

[sqlalchemy] mysql and python datetime

2013-04-04 Thread algotr8der
I am trying to insert records to a mysql database via python using the sqlalchemy package. I have columns that are datetime type in mysql that already have data of the following format: 2013-04-03 00:05:00-05:00' Note this is produced by the pytz module in python. I had no problem loading 6

[sqlalchemy] ORM Join with Group By

2013-04-04 Thread Thijs Engels
I was wondering whether someone would be able to help me out with a SQLAlchemy query (not sure whether this is the correct term) Assume a database with two tables; sessions and events. Sessions has a primary key id and some additional information. Events has a primary key which consists of session

Re: [sqlalchemy] implementing one-to-many relationship?

2013-04-04 Thread Michael Bayer
the requery is due to the default expire_on_commit of session.commit(): http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html#committing. Feel free to disable this feature if you don't need it. as far as one-to-many, I don't see the use of relationship() here, you'd likely find it easier to u

Re: [sqlalchemy] float values digits truncated

2013-04-04 Thread Michael Bayer
the MySQL dialects within SQLAlchemy don't touch floats at all, so this is probably a product of the DBAPI in use. Key information here would include specific MySQL version, storage engine, and DBAPI name / version - Python and OS version may be important as well. On Apr 4, 2013, at 1:57 P

Re: [sqlalchemy] how to prepare "get by primary key" query?

2013-04-04 Thread Michael Bayer
On Apr 4, 2013, at 2:03 PM, Roman Yakovenko wrote: > > In my case the performance boost was 30%. I have very few queries, but pretty > big loops, so compiling them in advance(outside of loop) gave me a > significant gain. > OK well we have the architecture in place to cache SQL expression

Re: [sqlalchemy] how to prepare "get by primary key" query?

2013-04-04 Thread Roman Yakovenko
On Wed, Apr 3, 2013 at 5:47 PM, Michael Bayer wrote: > > the Python DBAPI doesn't have an explicit concept of a "prepared > statement" - the idea of preparing a statement involves that a statement > handle is established on the database server, which can then be reused. > The closest the DBAPI has

[sqlalchemy] float values digits truncated

2013-04-04 Thread scientificSteve
Hello, I have got a problem with inserting large float values into a mysql database table. When inserting a new EventDb using a session with large values and 6 digits, the float value is truncated to 5 digits. See the output of the database engine: 2013-04-04 19:54:38,245 INFO sqlalchemy.engin