Re: [sqlalchemy] Query for date between a range

2013-10-09 Thread Enrico Morelli
ort hybrid_property > > > > class Plan(Base): > > @hybrid_property > > def calculated_date(self): > > return date(self.year, self.month, self.day) > > > > > > Also, in your query, don't use between: > > session.query(Plan).\ >

Re: [sqlalchemy] Query for date between a range

2013-10-04 Thread Enrico Morelli
On Fri, 4 Oct 2013 16:03:18 +0200 Enrico Morelli wrote: > On Fri, 4 Oct 2013 16:25:00 +0300 > "Ofir Herzas" wrote: > > > I'm sorry, you should use hybrid_property: > > > > from sqlalchemy.ext.hybrid import hybrid_property > > > >

Re: [sqlalchemy] Query for date between a range

2013-10-04 Thread Enrico Morelli
ion of sqlalchemy (0.6.8) that hasn't the hybrid module. It's a dog that bites its own tail. > > -Original Message----- > From: sqlalchemy@googlegroups.com > [mailto:sqlalchemy@googlegroups.com] On Behalf Of Enrico Morelli > Sent: Friday, October 04, 2013 4:05 PM >

Re: [sqlalchemy] Query for date between a range

2013-10-04 Thread Enrico Morelli
perty' object has no attribute 'between' > > -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalchemy@googlegroups.com] On Behalf Of Enrico Morelli > Sent: Friday, October 04, 2013 12:07 PM > To: sqlalchemy@googlegroups.com > Subject: [sq

[sqlalchemy] Query for date between a range

2013-10-04 Thread Enrico Morelli
27;%s%s%s' % (to_date.year, tmonth, tday) print fd, td results = Session.query(Plan.data, Plan.month,Plan.instrument_id,func.count(Plan.instrument_id)).filter( and_((Plan.year*1000+Plan.month*100+Plan.day).between(from_date, to_date), Plan.data.ilike('%%%s%%' % item),)).group_by(

[sqlalchemy] ManyToMany query

2012-07-24 Thread Enrico Morelli
) but the result isn't real. -- --- (o_ (o_ //\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +--+ | ENRICO MORELLI | email

Re: [sqlalchemy] Association Object creation

2011-11-23 Thread Enrico Morelli
On Wed, 23 Nov 2011 10:59:03 +0100 Enrico Morelli wrote: > These are the mappers: > mapper(Ligand, ligand_table, >properties={ > 'ligand':relationship(LigandLigand, > primaryjoin=and_(ligand_table.c.id==ligand_ligand_table.c.ligand_id1, >

[sqlalchemy] Association Object creation

2011-11-23 Thread Enrico Morelli
backref=backref('root')), }) When I try to access to the ligand.ligand properties, this is empty even if in the db there are relations. Where is the problem? Thanks -- --- (o_ (o_//\ Coltiva

Re: [sqlalchemy] SA remove related fields

2011-09-20 Thread Enrico Morelli
On Tue, 20 Sep 2011 09:32:09 -0400 Michael Bayer wrote: > > On Sep 20, 2011, at 9:28 AM, Enrico Morelli wrote: > > > > > Thanks, I tried to put passive_deletes='all' in the relationships: > > > > sorry, 'pdb':relationship(Pdb, backref

Re: [sqlalchemy] SA remove related fields

2011-09-20 Thread Enrico Morelli
On Tue, 20 Sep 2011 09:14:20 -0400 Michael Bayer wrote: > > On Sep 20, 2011, at 3:24 AM, Enrico Morelli wrote: > > > Dear all, > > > > I'm using SA 0.6.7 on a RHEL 6 with Python 2.6 and PostgreSQL 8.4.7. > > These are some table of my DB: > > pdb_

[sqlalchemy] SA remove related fields

2011-09-20 Thread Enrico Morelli
ror: for code in open(pdblist): pdb = Session.query(Pdb).filter(Pdb.code==code.strip()).all() for p in pdb: # Remove PDB Session.delete(p) Session.commit() Where I wrong? Thanks -- ------- (o_ (o_//\ Coltivate Linux che tanto Windows si pi

Re: [sqlalchemy] Dynamic query

2011-05-09 Thread Enrico Morelli
On Fri, 6 May 2011 17:11:39 +0100 "King Simon-NFHD78" wrote: > > -Original Message- > > From: sqlalchemy@googlegroups.com > > [mailto:sqlalchemy@googlegroups.com] On Behalf Of Enrico Morelli > > Sent: 06 May 2011 16:20 > > To: sqlalchemy

[sqlalchemy] Dynamic query

2011-05-06 Thread Enrico Morelli
-- (o_ (o_//\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +----------+ | ENRICO MORELLI | email: more...@cerm.unifi.it | | * * * *| phone: +39 0

Re: [sqlalchemy] Association object

2011-02-09 Thread Enrico Morelli
On Wed, 9 Feb 2011 10:34:22 +0100 Enrico Morelli wrote: > mapper(AtomInfo, atominfo_table, >properties={ > 'residue': relationship(ResidueInfo, backref='atominfo'), > 'periodic': relationship(Periodic, backref='atominf

[sqlalchemy] Association object

2011-02-09 Thread Enrico Morelli
om_atom_table, properties={ 'atom2': relationship(AtomInfo) }) Thanks -- --- (o_ (o_//\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +-

Re: [sqlalchemy] Complex query (for me)

2011-01-26 Thread Enrico Morelli
. (/)_ V_/_ +--+ | ENRICO MORELLI | email: more...@cerm.unifi.it | | * * * *| phone: +39 055 4574269 | | University of Florence| fax : +39 055 4574253 | | CERM

[sqlalchemy] Complex query (for me)

2011-01-26 Thread Enrico Morelli
e reports. Thanks -- --- (o_ (o_//\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +--+ | ENRICO MORELLI | email: more...@cerm.uni

Re: [sqlalchemy] order_by: ArgumentError

2010-11-17 Thread Enrico Morelli
On Tue, 16 Nov 2010 11:37:12 -0500 Michael Bayer wrote: > > On Nov 16, 2010, at 6:16 AM, Enrico Morelli wrote: > > > On Mon, 15 Nov 2010 15:56:06 -0500 > > Michael Bayer wrote: > > > >> its looking for a Column object.menus_table.c.weight instead of

Re: [sqlalchemy] order_by: ArgumentError

2010-11-16 Thread Enrico Morelli
['lang'])).order_by(menus_table.c.weight.asc()).all() but the error is the same: ArgumentError: Column-based expression object expected for argument 'order_by'; got: 'weight', type > > On Nov 15, 2010, at 10:03 AM, Enrico Morelli wrote: > > > Dear all, >

[sqlalchemy] order_by: ArgumentError

2010-11-15 Thread Enrico Morelli
enus_permissions_table) }) At the end the query: main_menu = Session.query(Menu).filter(and_(Menu.parent_id==None, Menu.lang==session['lang'])).order_by(Menu.weight.asc()).all() -- --- (o_ (o_//\ Coltiva

[sqlalchemy] Confusion about using Session() globally

2007-11-07 Thread Enrico Morelli
(o_ (o_//\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +--+ | ENRICO MORELLI | email: [EMAIL PROTECTED] | | * * * *| phone: +39 055 4574269 | | University of Florence| fax : +39

[sqlalchemy] Postgresql arrays

2007-01-04 Thread Enrico Morelli
: 'integer[]' -- --- (o_ (o_//\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +------+ | ENRICO MORELLI | email: [EMAIL PROTECTED] | | * * * *

[sqlalchemy] Re: session.flush() error

2006-11-28 Thread Enrico Morelli
ycopg in fact) > maps timestamps with DateTime objects. > > Thanks for your answer, but the problem is another. It's my brain, I wrote c.user_id=u instead c.user=u. I solved the problem. > Enrico Morelli wrote: > > Dear all, > > > > I've a strange problem with

[sqlalchemy] session.flush() error

2006-11-28 Thread Enrico Morelli
start_date)s, %(protein)s, %(status)s, %(program)s)' {'status': 'R', 'workdir': '/home/morelli', 'user_id': <__main__.Users object at 0xb75d55cc>, 'calculation_id': 11L, 'job': '1234', 'pro

[sqlalchemy] Re: SQLAlchemy 0.3.0 Released

2006-10-23 Thread Enrico Morelli
-- --- (o_ (o_//\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +--+ | ENRICO MORELLI | email: [EMAIL PROTECTED] | | *