[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
Hello, I tried all the method to compare the different methods : *TEST CODE* xref = time.time() self.UtilisateurCourant.Dispo = 1 session.merge(self.UtilisateurCourant, dont_load=True) session.flush() print With ORM dont_load,

[sqlalchemy] Combined type field and session handler

2009-10-01 Thread Andrey Semyonov
Hi, there. Just trying to make SA work with combined type field. First, I have such a type in PGSQL: CREATE TYPE mytype AS (id integer, flags integer, degrees numeric[]); Then I create a column in table 'mytable' as ALTER TABLE mytable ADD COLUMN tmpcol mytype[]; Then I declare

[sqlalchemy] Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Hi again, Is there any way to avoid checking database structure during the metadata.create_all declaration's phase? It can be good to check when we are in test phase but when we are in production and we are sure of our model, it can be good to bypass create_all checking to database.

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Christian Démolis Sent: 01 October 2009 10:40 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Bypass checking to database structure (metadata.create_all) Hi again,

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Thx Simon, I tried Base.metadata.create_all(engine, checkfirst=False) but it throws an error. When checkfirst is True, the declaration works. I don t understand... Maybe orm needs additional information in declarative classes when checkfirst=False because orm doesn t look in database in this

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread limodou
On Thu, Oct 1, 2009 at 6:25 PM, Christian Démolis christiandemo...@gmail.com wrote: Thx Simon, I tried Base.metadata.create_all(engine, checkfirst=False) but it throws an error. When checkfirst is True, the declaration works. I don t understand... Maybe orm needs additional information in

[sqlalchemy] Multiple Joined Inheritance Issues

2009-10-01 Thread Julian Krause
I have looked all over to a solution for this issue and haven't found a solution. I am trying to use inheritance more than one level deep and it does not seem to set the discriminator field on the top level item. It works fine if it is only subclassed once but when you try and do it twice it

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Ok, i just realize that create_all is useless when database already exist. Starting my application is 6 seconds faster now. Thanks all 2009/10/1 limodou limo...@gmail.com On Thu, Oct 1, 2009 at 6:25 PM, Christian Démolis christiandemo...@gmail.com wrote: Thx Simon, I tried

[sqlalchemy] Re: padding of CHAR fields, inconsistent where clause; Oracle example

2009-10-01 Thread volx
Micheal: Thanks for your help thus far. Unfortunately I don't think the get_dbapi_type method gets called. From reading your code I see how it should be called from pre_exec - setinputsizes - get_dbapi_type but empirical evidence shows otherwise. Here's my little harness: import

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Michael Bayer
Christian Démolis wrote: Hello, I tried all the method to compare the different methods : *TEST CODE* xref = time.time() self.UtilisateurCourant.Dispo = 1 session.merge(self.UtilisateurCourant, dont_load=True) session.flush()

[sqlalchemy] Re: padding of CHAR fields, inconsistent where clause; Oracle example

2009-10-01 Thread Michael Bayer
volx wrote: Micheal: Thanks for your help thus far. Unfortunately I don't think the get_dbapi_type method gets called. From reading your code I see how it should be called from pre_exec - setinputsizes - get_dbapi_type but empirical evidence shows otherwise. Here's my little harness:

[sqlalchemy] Re: relations with additional criteria

2009-10-01 Thread Martijn Faassen
Hey, Michael Bayer wrote: [snip] OK well I'm sure you noticed that RelationProperty was not designed to be subclassed. I would advise that your my_own_relation() function generate its own primaryjoin and secondaryjoin conditions which it passes as arguments to the relation(). Looking at

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Michael Bayer
Michael Bayer wrote: Christian Démolis wrote: Hello, I tried all the method to compare the different methods : Here's a decorator I would advise using: http://stackoverflow.com/questions/1171166/how-can-i-profile-a-sqlalchemy-powered-application/1175677#1175677 Also I would advise

[sqlalchemy] Re: relations with additional criteria

2009-10-01 Thread Michael Bayer
Martijn Faassen wrote: Hey, Michael Bayer wrote: [snip] OK well I'm sure you noticed that RelationProperty was not designed to be subclassed. I would advise that your my_own_relation() function generate its own primaryjoin and secondaryjoin conditions which it passes as arguments to

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
With debug mode it seems to take 0.15 second, my timer print 0.45 s i don t know why this difference? 2009-10-01 17:00:38,586 INFO sqlalchemy.engine.base.Engine.0x...7f50 UPDATE utilisateur SET `Dispo`=%s WHERE utilisateur.`IdU tilisateur` = %s 2009-10-01 17:00:38,586 INFO

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Michael Bayer
Christian Démolis wrote: With debug mode it seems to take 0.15 second, my timer print 0.45 s i don t know why this difference? 2009-10-01 17:00:38,586 INFO sqlalchemy.engine.base.Engine.0x...7f50 UPDATE utilisateur SET `Dispo`=%s WHERE utilisateur.`IdU tilisateur` = %s 2009-10-01

[sqlalchemy] Elixir 0.7.0 released!

2009-10-01 Thread Gaetan de Menten
I am very pleased to announce that version 0.7.0 of Elixir (http://elixir.ematia.de) is now available. As always, feedback is very welcome, preferably on Elixir mailing list. This release incorporates many small improvements and bug fixes across the board. Please look at

[sqlalchemy] Re: relations with additional criteria

2009-10-01 Thread Martijn Faassen
Hey, Michael Bayer wrote: subclass RelationProperty fine, but don't get involved with overriding its internal _xxx methods. So: Override do_init() completely (not calling the super do_init()). Do something like: def do_init(self): self._get_target()

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
Maybe because the database is in Tunisia and my Computer in France. I don t use sqlite, i use MySQL. I just did a test on internet in Tunisia, 39kbits/sec upload and 417kbits/sec 2009/10/1 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: With debug mode it seems to take 0.15

[sqlalchemy] SQLAlchemy, PostgreSQL and custom types

2009-10-01 Thread Orca
I have a problem with updating custom types in SQLAlchemy, issue is that when I modify object attributes they are not detected as modified. E/g: # python class to work with class BDelta(object): def __init__(self): self.id = None self.flags = None self.deltas = []

[sqlalchemy] Re: relations with additional criteria

2009-10-01 Thread Michael Bayer
Martijn Faassen wrote: Hey, Michael Bayer wrote: subclass RelationProperty fine, but don't get involved with overriding its internal _xxx methods. So: Override do_init() completely (not calling the super do_init()). no, call do_init(). def do_init(self): self.primaryjoin =

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Michael Bayer
Christian Démolis wrote: Maybe because the database is in Tunisia and my Computer in France. I don t use sqlite, i use MySQL. I just did a test on internet in Tunisia, 39kbits/sec upload and 417kbits/sec right but, you had these results: MySQLdb - .09 seconds ORM - .3 seconds so, network

[sqlalchemy] How to get SA column object from table.col, declarative attribute, or elixir entity attribute

2009-10-01 Thread Randy Syring
I am trying to write a datagrid library for sqlalchemy which will allow easy generation of tables from SA objects. I would like the datagrid to be able to accept a table column, declarative attribute, or elixir entity attribute interchangeably. Since I am building the SQL with queries, this has

[sqlalchemy] Re: How to get SA column object from table.col, declarative attribute, or elixir entity attribute

2009-10-01 Thread Michael Bayer
Randy Syring wrote: I am trying to write a datagrid library for sqlalchemy which will allow easy generation of tables from SA objects. I would like the datagrid to be able to accept a table column, declarative attribute, or elixir entity attribute interchangeably. Since I am building the

[sqlalchemy] Re: padding of CHAR fields, inconsistent where clause; Oracle example

2009-10-01 Thread volx
Here's my program, modified as you suggest. It also creates the table so you can try it on any instance of Oracle. No joy on the result. Seems like the set_inputsizes isn't called? How can I tell for certain? import sqlalchemy.types as sqltypes from exceptions import NotImplementedError class

[sqlalchemy] Re: padding of CHAR fields, inconsistent where clause; Oracle example

2009-10-01 Thread Michael Bayer
volx wrote: Here's my program, modified as you suggest. It also creates the table so you can try it on any instance of Oracle. No joy on the result. Seems like the set_inputsizes isn't called? How can I tell for certain? import sqlalchemy.types as sqltypes from exceptions import

[sqlalchemy] Re: Multiple Joined Inheritance Issues

2009-10-01 Thread Jarrod Chesney
I was trying to do the same thing, But i wanted a different discriminator for the second level of inheritance. I changed mine to use the same polymorphic_on for both levels and it seemed to work for me (although not exactly how i wanted it to be) My suggestion is : Get rid of your engineer_id

[sqlalchemy] Re: Aggregation funnctions as mapped column_properties

2009-10-01 Thread Bj
not sure if the example was clear enough. What I'm trying to do is to convert the following select to a mapped- class: select id, usr_id, rating, ( select COUNT(*) from ratings as r where r.id = ratings.id ), ( select AVG(r.rating) from ratings as r where r.id = ratings.id)

[sqlalchemy] Re: Aggregation funnctions as mapped column_properties

2009-10-01 Thread Michael Bayer
Bj wrote: not sure if the example was clear enough. What I'm trying to do is to convert the following select to a mapped- class: select id, usr_id, rating, ( select COUNT(*) from ratings as r where r.id = ratings.id ), ( select AVG(r.rating) from ratings as r where r.id =

[sqlalchemy] table name in foreign key in wrong case on Mac OS X

2009-10-01 Thread rootsmith
Previously I was doing development of a project on an Ubuntu 9.04 machine with MySQL 5.0 and just recently switched to doing development on a MacBook Pro. I installed identical versions of MySQL on the MacBook. I used the exact same source files and installed the same versions of all libraries