[sqlalchemy] Re: issue with delete(obj) and ManyToOne relations

2008-09-02 Thread Remi Jolin - SysGroup
le 02.09.2008 18:33 Michael Bayer a écrit: > On Sep 2, 2008, at 12:06 PM, Remi Jolin - SysGroup wrote: > > >> Hello, >> >> Here is a small example of my issue (it's Elixir syntax, but I think >> it's not an Elixir specific issue) : >> clas

[sqlalchemy] issue with delete(obj) and ManyToOne relations

2008-09-02 Thread Remi Jolin - SysGroup
Hello, Here is a small example of my issue (it's Elixir syntax, but I think it's not an Elixir specific issue) : class Rec(Entity): collection = ManyToOne('Coll') class Coll(Entity): recs = OneToMany('Rec') r1 = Rec() r2 = Rec() c = Coll(recs=[r1,r2]) at that time len(c.recs) == 2 if

[sqlalchemy] max(datetime) does not return a datetime. Bug or feature ?

2008-08-29 Thread Remi Jolin - SysGroup
Hello, consider the following (Elixir syntax sorry) class A(Entity): creation_date = Field(DateTime) ... A.query().max(A.creation_date) returns a unicode and not a datetime as max([a.creation_date for a in A.query()]) returns Is it a bug ? (sqlalchemy version 0.4.6) --~--~-~--~-

[sqlalchemy] Re: problem with Numeric type and mysqll

2007-09-07 Thread remi jolin
le 07.09.2007 20:26 jason kirtland a écrit: > remi jolin wrote: > >> le 07.09.2007 19:47 remi jolin a écrit: >> >>> le 07.09.2007 19:27 Michael Bayer a écrit: >>> >>> >>>> numeric types are going to come out using decimal

[sqlalchemy] Re: problem with Numeric type and mysqll

2007-09-07 Thread remi jolin
le 07.09.2007 19:47 remi jolin a écrit: > le 07.09.2007 19:27 Michael Bayer a écrit: > >> numeric types are going to come out using decimal.Decimal objects in >> 0.4 but not exactly sure whats happening there...do a repr(m.price). >> >> >> >

[sqlalchemy] problem with Numeric type and mysqll

2007-09-07 Thread remi jolin
Hello, I have the following definition (using Elixir) class Manifestation(Entity): has_field('price', Numeric) The DB is mysql and something like m = Manifestation(price=10.0) then when accessing to this manifestation again (after flush, clear, etc...) I have this strange behavior >>> m.pr

[sqlalchemy] Re: backref definitions

2007-06-27 Thread remi jolin
le 27.06.2007 15:36 Michael Bayer a écrit: > On Jun 27, 2007, at 6:00 AM, remi jolin wrote: > > >> Hello, >> >> Suppose we have the Address and User mappers as they are defined in >> SA's >> documentation >> >> I was wo

[sqlalchemy] backref definitions

2007-06-27 Thread remi jolin
Hello, Suppose we have the Address and User mappers as they are defined in SA's documentation I was wondering if the 2 syntax bellow were equivalent : 1/ User.mapper.add_property('addresses', relation(Address, backref=BackRef('user', **user_args)), **addresses_args) 2/ Address.mapper.add_pro

[sqlalchemy] Re: selectresults and activemapper : behavior changes between versions 0.3.1 and 0.3.6

2007-04-30 Thread remi jolin
Michael Bayer a écrit : > On Apr 30, 2007, at 9:42 AM, remi jolin wrote: > > >> Hello, >> >> I'm using selectresults and activemapper. >> in version 0.3.1 if I did something like x = >> Announces.select(Annonces.c.type=="A") I got

[sqlalchemy] selectresults and activemapper : behavior changes between versions 0.3.1 and 0.3.6

2007-04-30 Thread remi jolin
Hello, I'm using selectresults and activemapper. in version 0.3.1 if I did something like x = Announces.select(Annonces.c.type=="A") I got a SelectResults object. Now (0.3.6) I get a list of Announces (the query is done immediately). But if I don't specify anything in the select method (Announc

[sqlalchemy] Re: Stuck creating a custom relation using ActiveMapper

2007-04-16 Thread remi jolin
Hello, Paul Johnston a écrit : > Hi, > > I'm trying to create a relation like this > > Testing [1] -> [many] Target (where target.is_testtgt==0) > > i.e. I want to map only to Target rows that match the where condition. > > Now, this is easy enough using assign_mapper: > > assign_mapper(ctx, Test

[sqlalchemy] ActiveMapper : adding a DB column after a model change

2007-01-07 Thread remi jolin
I have defined a class like class Image(AciveMapper): class mapping: __table__ = "image" id = column(Integer, primary_key=True) url = column(Unicode(128)) and created the DB according to the model. I have modified the Image class to add a new column class Image(AciveMapper): class ma

[sqlalchemy] Re: no error when using wrong 'attribute' name on an object

2007-01-06 Thread remi jolin
Michael Bayer a écrit : well, theres nothing that says the attribute youre sending in is "wrong". classes in python dont have any notion of predeclared attribute names. a mapped class can have any number of other attributes which dont correspond to database-mapped attributes. Yes, of course

[sqlalchemy] no error when using wrong 'attribute' name on an object

2007-01-05 Thread remi jolin
Hello, suppose I have the following definition : class Color(ActiveMapper): class mapping: __table__ = "color" id = column(Integer, primary_key=True) color = column(Unicode(32), unique=True) my problem is that if I do a typo when trying to create or modify a "color" like