Hey,
I'm trying to optimized a selection of 3000+ items and due to some of the
overhead of inheritance of SQLObject, I want to do a very specific query. I
like the idea of using SQLBuilder to generate the query string, but ran into
a bit of a problem.
It may be that I don't understand the proper syntax for this, but here is what
I get and what I want (simplified a bit for brevity)
>from sqlobject.sqlbuilder import Select
>from mydataobjects import Contact, Company
>str(Select((Contact.q.id, Contact.q.firstName, Company.q.companyName),
Contact.q.companyID == Company.q.id))
File "<stdin>", line 1, in ?
...
"/usr/lib/python2.4/site-packages/SQLObject-0.8dev_r1706-py2.4.egg/sqlobject/sqlbuilder.py",
line 452, in __sqlrepr__
things.append(self.whereClause)
AttributeError: 'tuple' object has no attribute 'append'
I was hoping to get
'SELECT contact.id, contact.first_name, company.company_name FROM company,
contact WHERE ((contact.company_id) = (company.id))'
Kind of like what I get when I'm selecting only one column:
> str(Select(Contact.q.firstName, Contact.q.companyID == Company.q.id))
'SELECT contact.first_name FROM company, contact WHERE ((contact.company_id) =
(company.id))'
Any of you guys know how to create the query that I'm going for?
I might be able to patch sqlbuilder.py to convert that tuple into a string,
but I doubt that is the "right" way to do this.
Thanks,
--gabe
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss