Re: [sqlalchemy] Re: saving existing db object

2011-04-08 Thread Michael Bayer
On Apr 8, 2011, at 12:59 PM, gwozdziu wrote: > > #before executing this code we have object with id = 5 in our database > > obj = self.mapper.get_from_dto(dto) # creating the object from values > provided by user , this object has id = 5 > self.mapper.add(obj) # we are putting new object (with

Re: [sqlalchemy] Navigate through tree-like structure with sqlalchemy. Is it doable (now) ?

2011-04-08 Thread Hector Blanco
Thanks for the quick reply. I'll give it a try. 2011/4/8 Michael Bayer : > > On Apr 8, 2011, at 12:12 PM, Hector Blanco wrote: > >> Hello everyone: >> >> I have a tree-like structure (groups/nodes, basically) with Stores and >> StoreGroups. An store can belong only to one storeGroup, but an >> St

[sqlalchemy] Re: saving existing db object

2011-04-08 Thread gwozdziu
On Apr 8, 6:48 pm, gwozdziu wrote: > On Apr 8, 6:34 pm, Michael Bayer wrote: > > > > > On Apr 8, 2011, at 10:54 AM, gwozdziu wrote: > > > > Hi! > > > > In SqlAlchemy 0.4 when I tried to save (using method "save") to > > > database object which interferes row which already exists in database > > >

[sqlalchemy] Re: saving existing db object

2011-04-08 Thread gwozdziu
On Apr 8, 6:34 pm, Michael Bayer wrote: > On Apr 8, 2011, at 10:54 AM, gwozdziu wrote: > > > > > Hi! > > > In SqlAlchemy 0.4 when I tried to save (using method "save") to > > database object which interferes row which already exists in database > > (for example I have table with primary key `id`,

Re: [sqlalchemy] Navigate through tree-like structure with sqlalchemy. Is it doable (now) ?

2011-04-08 Thread Michael Bayer
On Apr 8, 2011, at 12:12 PM, Hector Blanco wrote: > Hello everyone: > > I have a tree-like structure (groups/nodes, basically) with Stores and > StoreGroups. An store can belong only to one storeGroup, but an > StoreGroup can contain stores or other storeGroups: > > class StoreGroup(BaseClass.B

Re: [sqlalchemy] saving existing db object

2011-04-08 Thread Michael Bayer
On Apr 8, 2011, at 10:54 AM, gwozdziu wrote: > Hi! > > In SqlAlchemy 0.4 when I tried to save (using method "save") to > database object which interferes row which already exists in database > (for example I have table with primary key `id`, row with id = 3 in > this table, and I am trying to sa

Re: [sqlalchemy] Oracle - create_engine fails - no attribute 'paramstyle'

2011-04-08 Thread Michael Bayer
that's a cx_oracle problem of some kind (like installation or version). "paramstyle" is a required attribute of a DBAPI and cx_oracle has it: >>> import cx_Oracle >>> cx_Oracle.paramstyle 'named' >>> from sqlalchemy import * >>> e = create_engine('oracle://uid:pwd@test1120') >>> e.dialect >>>

[sqlalchemy] Navigate through tree-like structure with sqlalchemy. Is it doable (now) ?

2011-04-08 Thread Hector Blanco
Hello everyone: I have a tree-like structure (groups/nodes, basically) with Stores and StoreGroups. An store can belong only to one storeGroup, but an StoreGroup can contain stores or other storeGroups: class StoreGroup(BaseClass.BaseClass, Database.Base): """Represents a storeGroup"""

[sqlalchemy] saving existing db object

2011-04-08 Thread gwozdziu
Hi! In SqlAlchemy 0.4 when I tried to save (using method "save") to database object which interferes row which already exists in database (for example I have table with primary key `id`, row with id = 3 in this table, and I am trying to save object with the same id = 3) the operation raises error

[sqlalchemy] Oracle - create_engine fails - no attribute 'paramstyle'

2011-04-08 Thread thanos
Using cx_oracle presents no problems but when I use >>>engine = create_engine('oracle://uid:pwd@test1120') dialect = dialect_cls(**dialect_args) File "c:\python26\lib\site-packages\sqlalchemy-0.6.4-py2.6.egg \sqlalchemy\dialects\oracle\cx_oracle.py", line 411, in __init__ OracleDialect.__i

Re: [sqlalchemy] ImmutableColumnCollection in 0.7b3

2011-04-08 Thread Michael Bayer
On Apr 8, 2011, at 7:57 AM, Szumo wrote: > Hello all, > > I've a following piece of code that used to work fine with SA 0.6.6, > but no longer > works with 0.7 due to table.columns becoming an immutable collection. > > def alterTableDropColumns(connection, table, *columns): >""" >Drop s

Re: [sqlalchemy] Re: Problem with "SAWarning: Multiple rows returned with uselist=False"

2011-04-08 Thread Michael Bayer
On Apr 8, 2011, at 7:08 AM, Aleksander Siewierski wrote: > Thanks for response, > > TaskIntro table is defined as: > > Table( >'task_intros', >METADATA, > >Column('id', Integer, primary_key=True), >... >Column('redirect_rule_id', Integer, > ForeignKey('r

[sqlalchemy] ImmutableColumnCollection in 0.7b3

2011-04-08 Thread Szumo
Hello all, I've a following piece of code that used to work fine with SA 0.6.6, but no longer works with 0.7 due to table.columns becoming an immutable collection. def alterTableDropColumns(connection, table, *columns): """ Drop some columns of a table. Parameters are expected to be s

[sqlalchemy] Re: Automatically retrieving the "row index"

2011-04-08 Thread Franck
Thanks Mike ! It was exactly the kind of tool I was looking for. Cheers, Franck On Apr 7, 1:20 pm, Mike Conley wrote: > Take a look at using ordering_list for the collection class on your > relation. You add a "position in season" and SQLAlchemy will maintain the > value. > > http://www.sqlalch

[sqlalchemy] Re: Problem with "SAWarning: Multiple rows returned with uselist=False"

2011-04-08 Thread Aleksander Siewierski
Thanks for response, TaskIntro table is defined as: Table( 'task_intros', METADATA, Column('id', Integer, primary_key=True), ... Column('redirect_rule_id', Integer, ForeignKey('redirect_rules.id'), nullable=True), mysql_engine='InnoDB', mys