[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread Florent Aide
Hi, As far as I know, sqlite does not allow you to store decimal objects, only floats. Which really is not the same. If you really need decimals (ie: accounting books anyone ?) then you should consider using firebird which is the only other database engine supported by SA that is embeddable in a

[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread svilen
decimals.. u can use pickling? slower, yes. On Friday 24 August 2007 10:37:53 Florent Aide wrote: Hi, As far as I know, sqlite does not allow you to store decimal objects, only floats. Which really is not the same. If you really need decimals (ie: accounting books anyone ?) then you should

[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread Paul Johnston
Hi, firebird which is the only other database engine supported by SA that is embeddable in a python application without the need of and external server. There is one other option, on Windows, the SA 0.4 beta supports Microsoft Access. I believe it works on all Windows systems (i.e. not

[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread svilen
i am storing only accounting amounts so i do care... long time ago there was no decimals easily available, so we used a fixed-point arithmetic (over integers) instead of decimals. either way, u cant store 1/3, and i dont think any db supports fractions. On Friday 24 August 2007 12:17:39

[sqlalchemy] Re: interface error with Decimal(0) in where clause

2007-08-24 Thread Florent Aide
How would you do something like this then: session.query.(LedgerLine).query(LedgerLine.base_amount.between(decimal1, decimal2)) the between() won't work since sqlite won't be able to compare your pickled amounts. Pickling cannot be an option in all cases particularly when you are storing

[sqlalchemy] One To Many Polymorphic Association.

2007-08-24 Thread praddy
## from sqlalchemy import * meta = BoundMetaData('sqlite://', echo=False) # Parents table. parents = Table('parents', meta, Column(id, Integer, primary_key=True), Column(data, String(50), nullable=False) ) #

[sqlalchemy] Re: One To Many Polymorphic Association.

2007-08-24 Thread Gaetan de Menten
You might be interested by: http://techspot.zzzeek.org/?p=13 (also in the examples directory of SQLAlchemy) On 8/24/07, praddy [EMAIL PROTECTED] wrote: ## from sqlalchemy import * meta = BoundMetaData('sqlite://', echo=False) #

[sqlalchemy] Generative group_by query specify columns

2007-08-24 Thread Curtis Scheer
What is the syntax to specify the columns in a generative query? q = session.query(Foo) q = q.group_by([foo_table.c.description]) for currow in q: print currow This query selects all the columns in the Foo table, wondering how to specify the columns to select.

[sqlalchemy] Re: One To Many Polymorphic Association.

2007-08-24 Thread Pradeep Jindal
On Friday 24 August 2007 19:20:00 Gaetan de Menten wrote: You might be interested by: http://techspot.zzzeek.org/?p=13 (also in the examples directory of SQLAlchemy) On 8/24/07, praddy [EMAIL PROTECTED] wrote: ## from sqlalchemy

[sqlalchemy] Problem Mapping table/relationship to a dictionary.

2007-08-24 Thread Nathan Harmston
Hi, I m trying to write a way of storing a 2 level dictionary in a database. class Foo(object): def __init__(self): self.a = {} def __iadd__(self, i): if i not in self.a: self.a[i] = {} return self def keys(self): for i in self.a.keys():

[sqlalchemy] Re: sql executemany and postgresql - probably bug

2007-08-24 Thread Michael Bayer
On Aug 23, 2007, at 11:18 AM, che wrote: Hi, On 23 Авг, 17:47, Michael Bayer [EMAIL PROTECTED] wrote: dont compile() the insert statement yourself here; since you are only executing it once, theres nothing to be gained by manually compiling first. this was the minimal code demonstrating

[sqlalchemy] Re: Join in where and using .join()

2007-08-24 Thread Michael Bayer
On Aug 24, 2007, at 1:26 AM, Arun Kumar PG wrote: Guys, Quick clarification: If we have two tables A and B with relationship keys 'XYZ' in both (B references A) then which is faster: 1) session.query(A).select_by(*[A.c.XYZ == B.c.XYZ]) or 2) session.query(A, B).join('XYZ') 2

[sqlalchemy] Re: Generative group_by query specify columns

2007-08-24 Thread Michael Bayer
On Aug 24, 2007, at 10:43 AM, Curtis Scheer wrote: What is the syntax to specify the columns in a generative query? q = session.query(Foo) q = q.group_by([foo_table.c.description]) for currow in q: print currow This query selects all the columns in the

[sqlalchemy] Re: Problem Mapping table/relationship to a dictionary.

2007-08-24 Thread Michael Bayer
On Aug 24, 2007, at 7:41 PM, Nathan Harmston wrote: Hi, I m trying to write a way of storing a 2 level dictionary in a database. class Foo(object): def __init__(self): self.a = {} def __iadd__(self, i): if i not in self.a: self.a[i] = {}

[sqlalchemy] why this Query API?

2007-08-24 Thread Marcos Dione
hi, I'm rather new to SQLAlchemy, using version 0.3.x right now. I would like to know the reason why Query.filter() returns another Query object instead of aplying in place, if there is one. an answer to this would help me to understand better this ORM.

[sqlalchemy] Re: why this Query API?

2007-08-24 Thread Eric Ongerth
Search the discussion group archive for the phrase (in quotes) in place and take a look at some of the related discussions from late June. On Aug 23, 2:10 pm, Marcos Dione [EMAIL PROTECTED] wrote: hi, I'm rather new to SQLAlchemy, using version 0.3.x right now. I would like to know the