[sqlalchemy] lower / upper case

2007-04-18 Thread Disrupt07
I have a users table and I want to query the usernames column. I want my query to ignore the upper/lower casing. So the following searches should all match John: john, jOhn, johN, JOhn, and so on. My query at the moment is a follows: names = queryselect(users.c.username.startswith(john))

[sqlalchemy] Re: lower / upper case

2007-04-18 Thread svilen
there was some thread about this 2week ago or so, look for ILIKE On Wednesday 18 April 2007 14:58:41 Disrupt07 wrote: I have a users table and I want to query the usernames column. I want my query to ignore the upper/lower casing. So the following searches should all match John: john,

[sqlalchemy] persistent to transient

2007-04-18 Thread mclark
Being new to sqlalchemy I gave myself an exercise to test my understanding: duplicating a database through objects. To my naive understanding, sessions act like Saran Wrap, they seem to stick to objects when I don't want them to, and not elsewhere. My toy example: # An attempt to duplicate a

[sqlalchemy] Re: lower / upper case

2007-04-18 Thread Jose Soares
Disrupt07 ha scritto: I have a users table and I want to query the usernames column. I want my query to ignore the upper/lower casing. So the following searches should all match John: john, jOhn, johN, JOhn, and so on. My query at the moment is a follows: names =

[sqlalchemy] Re: lower / upper case

2007-04-18 Thread Michael Bayer
On Apr 18, 2007, at 8:40 AM, Jose Soares wrote: Disrupt07 ha scritto: I have a users table and I want to query the usernames column. I want my query to ignore the upper/lower casing. So the following searches should all match John: john, jOhn, johN, JOhn, and so on. My query at

[sqlalchemy] Re: persistent to transient

2007-04-18 Thread Michael Bayer
On Apr 18, 2007, at 8:29 AM, [EMAIL PROTECTED] wrote: # Read from one data base engine = create_engine('sqlite:///Simple.db') metadata.connect(engine) session = create_session(bind_to=engine) objects = session.query(Simple).select() the objects are persistent (i.e. are represented in the

[sqlalchemy] @property

2007-04-18 Thread Julien Cigar
Hello, Simple question, I have a column score in a table which is defined as a property in my model : @property def score(self): weights = dict(high=3, medium=2, likely=2, low=1, unlikely=1) score = weights.get(self.dispersion_potential, 0) score +=

[sqlalchemy] Re: order_by on related object attribute?

2007-04-18 Thread Michael Bayer
On Apr 18, 2007, at 12:21 AM, Chris Shenton wrote: I'm using SQLAlchemy with Pylons and query my 'system' table and order by their client_id field like: from er.models import System, Vendor, Client sys = self.session.query(System).select(System.c.lastseen self.this_week,

[sqlalchemy] Re: @property

2007-04-18 Thread Sébastien LELONG
I know that I could use a mapper extension for this (with before_insert, before_update, etc) but could it not be possible to do it with my @property ? I think when SA apply the mapper (that is, assign), it overrides your property definition. You can ensure that by tracking if your property

[sqlalchemy] Re: @property

2007-04-18 Thread svilen
when u want it calculated? - just after load - just before save - if not set - always??? maybe use another attribute (_score) to store the value, map that one to table's column (either through mapper's property name or column's key), and let the score() either return _score if set or calc

[sqlalchemy] Subquery error with MySQL : SQLAlchemy bug ?

2007-04-18 Thread spastor
Hi Guys, I am trying to do this simple update query : s=select([table1.c.mo_id],and_(table1.c.msisdn==123,table2.c.mo_id==table1.c.mo_id)) s2=table2.update(table2.c.mo_id.in_(s),values={Del:tut}) against MySQL. running sqlAlchemy 0.35. I get the following error : (OperationalError) (1093, You

[sqlalchemy] Null Foreign key issues

2007-04-18 Thread wfpearson
A little background: In this application I need to match a Dictation to a Surgery all the surgeries must, by regulation be dictated within a certain time frame. I need too right a query that will return a list of all surgeries without a dictation. I would then iterate over that list matching the

[sqlalchemy] Re: Subquery error with MySQL : SQLAlchemy bug ?

2007-04-18 Thread Michael Bayer
On Apr 18, 2007, at 11:43 AM, [EMAIL PROTECTED] wrote: Hi Guys, I am trying to do this simple update query : s=select([table1.c.mo_id],and_ (table1.c.msisdn==123,table2.c.mo_id==table1.c.mo_id)) s2=table2.update(table2.c.mo_id.in_(s),values={Del:tut}) try calling s.correlate(table2)

[sqlalchemy] Re: Subquery error with MySQL : SQLAlchemy bug ?

2007-04-18 Thread Michael Bayer
On Apr 18, 2007, at 11:43 AM, [EMAIL PROTECTED] wrote: Hi Guys, I am trying to do this simple update query : s=select([table1.c.mo_id],and_ (table1.c.msisdn==123,table2.c.mo_id==table1.c.mo_id)) s2=table2.update(table2.c.mo_id.in_(s),values={Del:tut}) theres a fix in r2515 which will