[sqlalchemy] writing on db performances

2012-08-23 Thread andrea crotti
I'm doing some experiments to see what is the best approach to write a lot of data on disk, On file and running commit after every opoeration: Function in_file took 64.531976 seconds to run In memory and not dumping to file: Function in_memory took 0.242011 seconds to run On file and

[sqlalchemy] Create tables from class declaration

2012-08-21 Thread andrea crotti
The question is probably very simple, but I can't find an answer anywhere... Suppose I already have some tables declarad in a declarative way, as below, how do I create the database schema from them? I usually always did with the meta.create_all() after defining the various Table('name', meta...)

Re: [sqlalchemy] Create tables from class declaration

2012-08-21 Thread andrea crotti
2012/8/21 Simon King si...@simonking.org.uk: The MetaData instance is available via the declarative base class, so you should be able to do something like: Base.metadata.create_all() http://docs.sqlalchemy.org/en/rel_0_7/orm/extensions/declarative.html#accessing-the-metadata Hope that

[sqlalchemy] Simplified database

2012-06-29 Thread andrea crotti
I am rewriting a big codebase that has to deal with an overly complicated database. So one thing which I found very useful for testing purposes is to replicate only the tables and columns that I actually need and load them in a memory database to play around with things. So for example I have

[sqlalchemy] Long expressions

2012-06-29 Thread andrea crotti
Supposing for example that I want to do a simple select * from table it becomes: table.select().execute().fetchall() which is a bit harder to understand, and things get more complicated (for me at least) with joins co. Is there a good explanation somewhere of the algorithm that actually