[sqlalchemy] EOFError while querying

2011-07-04 Thread rajasekhar911
Hi , I am getting EOFError while querying a table . The select contains String fields, integer fields , a BLOB and a TEXT filed. The error happens consistently. This is happening in a customer envt. Anybody has any idea on what could be the issue? Thanks in advance stack trace is given below

[sqlalchemy] Re: Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-07-04 Thread Adrian
Yes, the __eq__() and __hash__() functions are overridden to compare the primary keys (e.g. self.id==other.id, or hash(self.id)). The orm query works as expected once I remove them from the Entity class definition. On Jul 1, 4:03 pm, Michael Bayer mike...@zzzcomputing.com wrote: does your Entity

[sqlalchemy] Re: Using custom function expression throws 'TypeError: an integer is required' in orm query

2011-07-04 Thread Adrian
I found the problem now - the __hash__() function I had did not return an integer, it returned a tuple of the composite primary key. I changed it now and it works, thanks for your help! On Jul 4, 8:50 am, Adrian adr...@schreyer.me wrote: Yes, the __eq__() and __hash__() functions are overridden

[sqlalchemy] How to explicit name aliased classes in joins of orm.query

2011-07-04 Thread Michael Tils
Hi there, I have a problem to understand how aliased classes are used in orm.query. I have an polymorphic single-inheritance table, which is a lookup table for about 10 other tables. On some of that tables there are more than one column which relates to that table, so they have to be aliased.

Re: [sqlalchemy] EOFError while querying

2011-07-04 Thread Michael Bayer
loads() implies you're using PickleType even though not indicated here (just a query by itself tells us very little btw) and the EOFError implies the binary data being loaded is not a valid pickle string. On Jul 4, 2011, at 3:09 AM, rajasekhar911 wrote: Hi , I am getting EOFError while

Re: [sqlalchemy] How to explicit name aliased classes in joins of orm.query

2011-07-04 Thread Michael Bayer
On Jul 4, 2011, at 2:29 AM, Michael Tils wrote: rating = aliased(BuildingRating) care_level = aliased(BuildingCareLevel) to make later: .query(Building).filter( or_( rating.value.like(%good), care_level.value.like(well_groomed) ) ) But I couldn't work out how to explicit name

Aw: Re: [sqlalchemy] How to explicit name aliased classes in joins of orm.query

2011-07-04 Thread Michael Tils
Hello, thanks for your help. The joins Building.condition and Building.care_level are pointing the same table. The table is a single-inheritance construct. The query: session.query(Building).join(rating, Building.condition).join(care_level, Building.care_level) produces this error:

Aw: Re: Aw: Re: [sqlalchemy] How to explicit name aliased classes in joins of orm.query

2011-07-04 Thread Michael Tils
Here is my mapping, this time in german... Building class: class Lookup(OrmBaseObject): id = 0 lookupCategoryId = 0 category = LookupCategory value = '' properties = { 'lookupCategoryId':tables['lookup'].c.lookup_category_id, 'category':

[sqlalchemy] confused on avoiding sql injections using ORM

2011-07-04 Thread Krishnakant Mane
Hello all. I use Pylons 0.9.7 and sqlalchemy. I use the Object Relational Mapper with declarative syntax in a few of my modules. I was reading chapter 7 of the Pylons book and I understood that sql injections can be avoided using the expression api. But can this be also done using ORM? I tryed

Re: Aw: Re: Aw: Re: [sqlalchemy] How to explicit name aliased classes in joins of orm.query

2011-07-04 Thread Michael Bayer
On Jul 4, 2011, at 3:25 PM, Michael Tils wrote: Here is my mapping, this time in german... OK, sifting through lots of extraneous details as well as the lack of the actual table definitions, it seems like you're looking to join from Building-BuildingCondition-Lookup. I don't use

[sqlalchemy] Re: confused on avoiding sql injections using ORM

2011-07-04 Thread Malthe Borch
Think about it this way: There's two kinds of strings when you're dealing with SQL: 1) SQL language, 2) your data input. Don't ever include (2) in (1) –– let the API do it. \malthe On 4 July 2011 21:41, Krishnakant Mane krm...@gmail.com wrote: Hello all. I use Pylons 0.9.7 and sqlalchemy. I

[sqlalchemy] Re: confused on avoiding sql injections using ORM

2011-07-04 Thread Sergey V.
Can you give an example of sql injection working with ORM? Some sample code etc. On Jul 5, 5:41 am, Krishnakant Mane krm...@gmail.com wrote: Hello all. I use Pylons 0.9.7 and sqlalchemy. I use the Object Relational Mapper with declarative syntax in a few of my modules. I was reading chapter

Re: [sqlalchemy] Re: confused on avoiding sql injections using ORM

2011-07-04 Thread Krishnakant Mane
On 05/07/11 03:03, Malthe Borch wrote: Think about it this way: There's two kinds of strings when you're dealing with SQL: 1) SQL language, 2) your data input. Don't ever include (2) in (1) –– let the API do it. How does one do this with the orm? I am talking about things like session.add