[sqlalchemy] Error with SqlSoup and Firebird engine

2010-07-31 Thread maxi
Hi, I'm trying to use SqlSoup with firebird backed. My environment is: python 2.6, sqlalchemy 0.6.3 all in virtualenv. The firebird version is 2.1 I do all steps to do a simple test: db = SqlSoup('firebird://SYSDBA:master...@127.0.0.1/home/maxi/ databases/test.fdb') people = db.people.all

[sqlalchemy] Declarative base and Adjacency List Relationships

2009-08-03 Thread maxi
, queries_group, properties={ 'children': relation(QueryGroup, cascade=all, backref=backref(parent, remote_side= [queries_group.c.qry_grp_id])) } ) Can I do the same using declarative style? How? Thanks in advance. --- Maxi

[sqlalchemy] getting columns name from query result

2009-02-04 Thread maxi
Hi, Are there any approach to get columns names from query result ? I'm executing a dynamic sql statemet using text function and execute. s = 'select * from foo where foo.name like = :name' txt = text(s, bind=database.metadata.bind) p = {'name':u'some name'} result = txt.execute(p).fetchall()

[sqlalchemy] Many to many relationship problem

2008-04-22 Thread maxi
Hi, I've a problem to do a many to many relationship mapper declaration. I will try to explain this with an example: person_table(per_id, name, ...) per_per_table(id, per_orig_id, per_dest_id) per_orig_id = foreign key, reference to person_table.per_id per_dest_id = foreign key, reference to

[sqlalchemy] Using substring function

2008-04-11 Thread maxi
Hi, I need to use substring function into sql statement. For it, I define the next sql: _sql = select([func.substring(planilladet.c.msg_debug, 1, 40).label('msg_debug'), func.sum(planilladet.c.cant).label('cant'), func.sum(planilladet.c.cant * planilladet.c.importe).label('importe')], \

[sqlalchemy] Re: Using substring function

2008-04-11 Thread maxi
(ProgrammingError) (-104, 'isc_dsql_prepare: \n Dynamic SQL Error\n SQL error code = -104\n Token unknown - line 1, column 39\n ,') 'SELECT substring(planilladet.msg_debug, ?, ?) AS msg_debug, sum(planilladet.cant) AS cant, sum(planilladet.cant * planilladet.importe) AS importe \nFROM

[sqlalchemy] Re: Update master-detail problem

2008-02-22 Thread maxi
is the SQL emitted ? No, It isn't. By example, if I modify master record data usr1.name = new name and modify any addresses object (like first example) the sql statement (UPDATE) is generated for users table but not for addresses table. is it possible your session is in an open transaction and

[sqlalchemy] Re: SQLAlchemy 0.4.3 Released

2008-02-15 Thread maxi
Great Job !!! How can I upgrade from 0.4.2p3 ? (Or I have to uninstall all previous version?) Regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Executing sql text from session

2008-02-13 Thread maxi
Hi, I'm reading sqlalchemy 0.4 documentation about how execute a sql text from session obejct. In this example, Session = sessionmaker(bind=engine, transactional=True) sess = Session() result = sess.execute(select * from table where id=:id, {'id':7}) It's only present in 0.4.x versions ? How

[sqlalchemy] Re: Refresh problem in orm

2008-02-11 Thread maxi
Thanks for your replay, The easiest in this case is to use query.populate_existing(): sess.query(Person).populate_existing().filter_by().all() however, this method is only available in 0.4. How work this ? This method - populate_existing() - re-read from database ? in 0.3, several

[sqlalchemy] Re: Search in object list by field value

2008-02-08 Thread maxi
Thanks Simon, I was doing of that manner. Now, is advisable implement my own custom collection ? (One what implement a locate method for example) I was reading Custom Collection Implementations on sqlalchemy doc, but I'am not very clear over how implement this. Any help with this? Regards.

[sqlalchemy] Object list synchronization

2008-02-06 Thread maxi
Hi, I will try to expose my scenario: I'am using sqlalchemy 0.3.10, Firebird 2.0.x and PyGtk for build a desktop application in Windows XP. I've a window form which contains a gtk TreeView (and many other widgets). This is used for data entry in a master/detail structure. Then, I've a mapper

[sqlalchemy] Re: ConcurrentModificationError without concurrent modification?

2008-01-24 Thread maxi
One more thing, I remove the many to many mapper (for ConvPre class and the associated mapper) and: - This work fine on sa 0.4.x - This don't work on sa 0.3.10 Are there any changes relative a this problem in 0.4.x versions ? --~--~-~--~~~---~--~~ You received

[sqlalchemy] [REPEAT] ConcurrentModificationError without concurrent modification?

2008-01-23 Thread maxi
Hi, I've a problem like this: http://groups.google.be/group/sqlalchemy/browse_thread/thread/e3ff5bd168f5045a Now, I'am using sqa 0.3.10, and a very complex mapper estructure. orm.mapper(PrestacionGrupo, prestacion_grupo) orm.mapper(Prestacion, prestacion, properties={ 'grupo':

[sqlalchemy] Re: [REPEAT] ConcurrentModificationError without concurrent modification?

2008-01-23 Thread maxi
the error is specifically about a many to many table where it expects to delete two rows but only one matches the criteria. If you are using more than one session, or removing rows from a many to many table using SQL statements, this error can occur. Sorry, I'am a little confuse abut it. (I

[sqlalchemy] Re: [REPEAT] ConcurrentModificationError without concurrent modification?

2008-01-23 Thread maxi
do you have anything else mapped to the conv_pre table ? it should *only* be mentioned in one place in your mapping setup. I only have something like this: class ConvPre(DBObject): pass mapper(ConvPre, conv_pre) --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: [REPEAT] ConcurrentModificationError without concurrent modification?

2008-01-23 Thread maxi
OK, then you *cannot* use conv_pre as the secondary argument in another relation(). You need to use an association: If I remove ConvPre class and conv_pre mapper too. This problem is solved ? I don't need this class and mapper really. BTW, I will take a look to associationproxy, this look

[sqlalchemy] object has no attribute '_sa_session_id' error on session.clear()

2008-01-15 Thread maxi
Hi, I've an error when I try to execute a clear() method from session object. Traceback (most recent call last): File V:\nacer\bin\gui\planilla.py, line 280, in on_btn_apply_clicked self._savePlanilla() File V:\nacer\bin\gui\planilla.py, line 200, in _savePlanilla

[sqlalchemy] problems with filter_by()

2008-01-14 Thread maxi
Hi, I recently upgrade from sqlalchemy 0.3.10 to 0.4.2p3. I have a method like this: def getPlanillaDet(self, plan_id): return session.query(PlanillaDet).filter_by(Planilladet.c.plan_id==plan_id).all() Now, after update, when I try to execute this method, I get an exception with the

[sqlalchemy] Re: problems with filter_by()

2008-01-14 Thread maxi
Thaks for your help. Can you post an example over how to use filter and filter_by in new sqlalchemy versions? Is your recommendation included in 0.3 to 0.4 migration guide? Why this change? Regards. --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] MapperExtension upgrade

2008-01-14 Thread maxi
Hi, In new sqlalchemy version (0.4), the MapperExtension must return EXT_CONTINUE for each method. Now, all methods must return this const? For instance, I've the next extension for my mapper: class ConvenioExtension(MapperExtension): def create_instance(self, mapper, selectcontext, row,

[sqlalchemy] InvalidRequestError when I try to save object

2008-01-14 Thread maxi
Hi, Follwing with my 0.3 to 0.4 upgrade, now I get the next problem... When I try to save an object across my session, I get an InvalidRequestError exception with the message: File c:\programs\python25\lib\site-packages\sqlalchemy-0.4.2p3- py2.5.egg\sqlalchemy\orm\session.py, line 988, in

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread maxi
I must use save_update alone or save_update + flush ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this

[sqlalchemy] Re: InvalidRequestError when I try to save object

2008-01-14 Thread maxi
But, is my design mistake ? I must use ever save_or_update() function? In my case, I have two process working over the same class of bussines object. I do a query, which return me an object list and I call to other function which pass one parameter (id) and this function do other query over the

[sqlalchemy] SqlAlchemy 0.4 and py2exe. Problem solved?

2008-01-14 Thread maxi
Is solved the problem involved in py2exe and sqlalchemy 0.3 ? Can I use py2exe without problem with loggin module? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] Virtual column-attribute

2007-12-19 Thread maxi
Hi, I hope sombody can help me whit this. I've the next table, for instance: customer = Table('customer', metadata, Column('id', Integer, primery_key=True), Column('name', String(50), nullable=False) ) andthe class class Customer(object): pass and.. the mapper