[sqlalchemy] Performing a search

2006-11-06 Thread Alexandre CONRAD
Hello, what would be the best way to perform a search against columns of a table ? I have the following code that works fine: pattern = %bla% client_list = self.query.select(or_(model.Client.c.name.like(pattern), model.Client.c.contact.like(pattern), model.Client.c.email.like(pattern)))

[sqlalchemy] Re: Activemapper and multiple Foreign Keys

2006-11-06 Thread Gaetan de Menten
On 11/6/06, percious [EMAIL PROTECTED] wrote: I think I have reached the limit of what activemapper can do for me! Consider the following example: class Alarm(ActiveMapper): class mapping: __table__ = Alarm alarmID = column(Integer, primary_key=True)

[sqlalchemy] Re: Performing a search

2006-11-06 Thread Dennis
On Nov 6, 4:29 am, Alexandre CONRAD [EMAIL PROTECTED] wrote: Hello, what would be the best way to perform a search against columns of a table ? I have the following code that works fine: pattern = %bla% client_list = self.query.select(or_(model.Client.c.name.like(pattern),

[sqlalchemy] Re: polymorphic_identity determination

2006-11-06 Thread Michael Bayer
hey, no, youre doing great, breaking new ground yourself. i havent spent much time with inheritance scenarios other than what you see in the examples and unittests (and a lot of that other people came up with). just as long as the rowsets contain the information, things are good. this is also

[sqlalchemy] Re: Performing a search

2006-11-06 Thread Martin Kaffanke
Am Montag, den 06.11.2006, 16:15 + schrieb Dennis: SELECT clients.name AS clients_name, clients.contact AS clients_contact, clients.email AS clients_email, clients.id_client AS clients_id_client FROM clients WHERE clients.name LIKE %s OR clients.contact LIKE %s OR clients.email LIKE

[sqlalchemy] SQL join problem

2006-11-06 Thread Paul K
I'm having difficulty with table joins not using my foreign keys. A corrected query would produce modules.module_id = module_extra_keys.module_id in the WHERE clause. But in the below test code, it does not. However, if I use the get_by() function of the data_mapper the SQL is correct.

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-06 Thread Randall Smith
dmiller wrote: Is there a reason why this doesn't work: orders = Table('orders', meta, Column('id', Integer, Sequence('order_id_seq'), primary_key=True), ... ) items = Table('items', meta, Column('id', Integer, Sequence('item_id_seq'), primary_key=True),

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-06 Thread dmiller
On Nov 6, 2006, at 3:31 PM, Randall Smith wrote: dmiller wrote: Is there a reason why this doesn't work: ... order = session.query(Order).get(1) # assume order exists itemsNotInOrder = session.query(Item).select(Item.c.order != order) # ERROR! This should work. itemsNotInOrder =

[sqlalchemy] Re: Unicode in sqlite

2006-11-06 Thread Michael Bayer
sqlite hasnt been tested with that particular configurational change (never knew it was possible, and it seems like it may not be working completely). however, SA will by default have nothing to do with unicode, if you arent using convert_unicode or any Unicode column types. encoding does

[sqlalchemy] Re: Constructing where-clauses dynamically

2006-11-06 Thread Michael Bayer
the c namespace is only for table columns. if we wanted a namespace that had represented mapper properties, which is not just column-mapped attributes but relationships as well, that would be something else altogether. we'd have to define a whole package of expression objects that represent

[sqlalchemy] Re: SQL join problem

2006-11-06 Thread Michael Bayer
if youre adding ClauseElements to select_by, all the automatic joining logic does not take effect for those. By ClauseElement, i mean when you say: select_by(someclass.c.somecol == 'somevalue') the == operation produces a new object called a ClauseElement, and is passed to the select_by