Re: [sqlalchemy] Not able to filter column by datetime

2015-04-16 Thread Juan Antonio Ibáñez
Thank you Michael, I think sometimes I am blind xD Regards El miércoles, 15 de abril de 2015, 15:13:38 (UTC+2), Michael Bayer escribió: On 4/15/15 6:52 AM, Juan Antonio Ibáñez wrote: Hello, I have dozens of queries filtering DateTime columns but I have got one I don't know why

[sqlalchemy] Not able to filter column by datetime

2015-04-15 Thread Juan Antonio Ibáñez
Hello, I have dozens of queries filtering DateTime columns but I have got one I don't know why it doesn't work. I have: --- q = DBSession.query(func.sum(RecargaCredito.importe), Local.nombre)\ .join((Local, RecargaCredito.locales_id == Local.id)) fl_desde =

[sqlalchemy] DateTime format

2012-08-21 Thread Juan Antonio Ibáñez
Hello, I am using Sqlalchemy under Turbogears and I'd like to know which is the best way to customize column to string conversion of a DateTime column. I need to do it in an automatic way instead having to format it before showing. Regards -- You received this message because you are

Re: [sqlalchemy] Multi-values custom mapped collection

2012-06-04 Thread Antonio Beamud Montero
El 04/06/12 16:37, Michael Bayer escribió: On Jun 1, 2012, at 12:30 PM, Antonio Beamud Montero wrote: El 01/06/12 16:59, Michael Bayer escribió: @appender needs to be a method that just accepts a mapped object to be added to the collection. then, @internally_instrumented is needed

[sqlalchemy] Multi-values custom mapped collection

2012-06-01 Thread Antonio Beamud Montero
Hi all: I'm trying to implement a permission system usign polymorphic associations. In my example only one object has permissions associated (ULine). The problem is trying to use a mapping with permission names as keys, and values Permission objects with a 1:1 user relation. A complete

Re: [sqlalchemy] Multi-values custom mapped collection

2012-06-01 Thread Antonio Beamud Montero
) @collection.remover def _remove(self, perm): self[perm.permission].remove(perm) @collection.iterator def __iter__(self): for vals in self.itervalues(): for perm in vals: yield perm On Jun 1, 2012, at 9:38 AM, Antonio Beamud Montero wrote: Hi

Re: [sqlalchemy] Multi-values custom mapped collection

2012-06-01 Thread Antonio Beamud Montero
El 01/06/12 16:59, Michael Bayer escribió: @appender needs to be a method that just accepts a mapped object to be added to the collection. then, @internally_instrumented is needed to prevent the collections system from placing additional insturmentation on standard methods like __setitem__.

[sqlalchemy] Count over aliased JOIN

2010-11-23 Thread Juan Antonio Ibáñez
Hello I am joining one table with itself so I am using alias as: alias_usuarios1 = aliased(Usuario) alias_usuarios2 = aliased(Usuario) usuarios = DBSession.query(alias_usuarios1, alias_usuarios2.nombre).filter(alias_usuarios1.resellers_id == alias_usuarios2.id)

[sqlalchemy] Subtransactions problem

2010-10-14 Thread Juan Antonio Ibáñez
Hello! I am dealing with Turbogears and SQL Alchemy. I need to make one import from a CSV file to a MySQL DB. I need also to controll which rows fails on import. I am working with the next code inside a loop: try: session.begin(subtransactions=True)

[sqlalchemy] Variable intersect argument list

2009-12-09 Thread Antonio Beamud Montero
Hi all: I'm trying to generate a intersect statement with variable argument list, I've tried something like: ... ltags = ['news', 'publicity'] s = select([tags.c.channel], tags.c.tag == ltags[0]) for tag in ltags[1:]: s.intersect(select([tags.c.channel], tags.c.tag ==

Re: [sqlalchemy] Variable intersect argument list

2009-12-09 Thread Antonio Beamud Montero
Alex Brasetvik escribió: On Dec 9, 2009, at 12:41 , Antonio Beamud Montero wrote: s.intersect(select([tags.c.channel], tags.c.tag == tag)) This is returning a new select which is the intersection --- which you are throwing away. It is *not* modifying s in-place. You

[sqlalchemy] Thread safes transactions

2009-03-06 Thread Antonio Beamud Montero
Hi all: I'm using only sqlalchemy sql expression language, and in documentation appears that transactions objects are not thread safe.. Need I to implement a decorator like this? def transactional(fn): def transact(self, *args): c = self.engine.connect() lock.acquire()

[sqlalchemy] postgresql rules and update

2007-06-13 Thread Antonio
hi all, I've partition a table in PostgreSQL, with rules on UPDATE, DELETE and INSERT. When I INSERT a row, ok, but when i UPDATE a row, the program raise: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1 I know that when i use a RULE the command

[sqlalchemy] Re: postgresql rules and update

2007-06-13 Thread Antonio
* mercoledì 13 giugno 2007, alle 09:15, Michael Bayer wrote : SQLAlchemy's ORM relies upon cursor.rowcount after an UPDATE or DELETE to get the number of rows affected. Why exactly does your rule cause this to fail ? because is a 'INSTEAD RULE' the base table 'prev' has no row ...

[sqlalchemy] Re: Problem with array fields in postgres

2007-01-20 Thread Antonio
* sabato 20 gennaio 2007, alle 02:57, exhuma.twn wrote : Sorry, but I don't understand how create, insert or select data with the array field in postgres. I use a composite type in PostgreSQL fatture=# \d datirim Composite type public.datirim Column | Type

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-18 Thread Antonio
* mercoledì 17 gennaio 2007, alle 09:30, Michael Bayer wrote : print Content-type:text/pdf\n\n# whatever the header is for pdf for chunk in res.pdf: sys.stdout.write(chunk.data) I would agree that the approach taken by pg_largeobject is a useful approach in that you can read just