Re: [sqlalchemy] Cascading orphan deletes in self-referential table

2010-04-25 Thread Adrian
> Does specifying cascade='all, delete-orphan' on the parent > relationship accomplish what you're after? delete-orphan doesn't work in self-relational relationships (there are always some nodes without a parent). However, moving passive_deletes=True into the backref() fixed it. -- Adrian -- Yo

Re: [sqlalchemy] custom dialect with no "join" syntax support possible?

2010-04-25 Thread Michael Bayer
On Apr 25, 2010, at 10:32 PM, Lance Edgar wrote: > Michael, thanks for the tip(s). From what I can tell, SQLBase does also use > the (+) syntax for outer joins. However, my requirements for this dialect > are so specific that I won't bother adding that to my compiler unless/until I > or some

Re: [sqlalchemy] sql particle as bind parameter option:

2010-04-25 Thread Michael Bayer
On Apr 25, 2010, at 7:46 PM, Michael Bayer wrote: > > You can acheive mostly the result you want using a custom SQL expression > construct, in conjunction with sqlalchemy.ext.compiler. The construct would > peek into a context-specific dictionary for its contents at compile time and > forwar

Re: [sqlalchemy] Mapping dictionaries with string keys and record values

2010-04-25 Thread Michael Bayer
On Apr 25, 2010, at 10:18 PM, Michael Bayer wrote: > > On Apr 25, 2010, at 7:31 PM, Michael Bayer wrote: > >> >> >> >> >> On Apr 25, 2010, at 1:38 PM, Torsten Landschoff >> wrote: >> >>> Hi everybody. >>> >>> After reading the documentation on dictionary based collections at >>>

Re: [sqlalchemy] custom dialect with no "join" syntax support possible?

2010-04-25 Thread Lance Edgar
On 4/20/2010 6:25 PM, Michael Bayer wrote: On Apr 20, 2010, at 4:47 PM, Lance Edgar wrote: Hi, I'm writing a new custom dialect for a legacy database (Centura SQLBase 7.5.1) for use in migrating to a new system over time. Everything's gone pretty well, until I needed a join... Whereas most di

Re: [sqlalchemy] Mapping dictionaries with string keys and record values

2010-04-25 Thread Michael Bayer
On Apr 25, 2010, at 7:31 PM, Michael Bayer wrote: > > > > > On Apr 25, 2010, at 1:38 PM, Torsten Landschoff > wrote: > >> Hi everybody. >> >> After reading the documentation on dictionary based collections at >> ,

Re: [sqlalchemy] sql particle as bind parameter option:

2010-04-25 Thread Michael Bayer
On Apr 23, 2010, at 12:13 PM, Paul Balomiri wrote: On 23.04.2010, at 17:03, Michael Bayer wrote: On Apr 23, 2010, at 9:59 AM, Paul Balomiri wrote: Hi, Thanks, for your reply. I was aware that it is not just a string substitution, and that the bindparams also maps the type o

Re: [sqlalchemy] Cascading orphan deletes in self-referential table

2010-04-25 Thread Lance Edgar
On 4/25/2010 6:39 AM, Adrian wrote: class MenuNode(Base): __tablename__ = 'menu' id = Column(Integer, primary_key=True, nullable=False, unique=True) parent_id = Column(Integer, ForeignKey('menu.id', onupdate='CASCADE', ondelete='CASCADE'), nullable=True, index=True) name = Col

Re: [sqlalchemy] Mapping dictionaries with string keys and record values

2010-04-25 Thread Michael Bayer
On Apr 25, 2010, at 1:38 PM, Torsten Landschoff > wrote: Hi everybody. After reading the documentation on dictionary based collections at , I am wondering if I am the only one who things that this code is intuiti

Re: [sqlalchemy] How do we retrieve the database dialect that a specific session is using?

2010-04-25 Thread Michael Bayer
On Apr 24, 2010, at 10:00 AM, Roy Hyunjin Han > wrote: Is there any way to retrieve the database dialect that a specific session is using? e.g. MySQL, PostGIS, etc. I am trying to modify Sanjiv Singh's GeoAlchemy extension so that a person can retrieve the appropriate database procedure f

Re: [sqlalchemy] Mapper table properties

2010-04-25 Thread Michael Bayer
On Apr 23, 2010, at 11:29 AM, Jason Baker wrote: Given an entity class (or entity instance), I'd like to get the table that is mapped to it. If I get the mapper using object_mapper/ class_mapper, then I get a mapper with the following properties defined (among others): local_table, ma

[sqlalchemy] Cascading orphan deletes in self-referential table

2010-04-25 Thread Adrian
Hi, I'm using the following table (shortened, removed unnecessary columns) to store a menu tree. class MenuNode(Base): __tablename__ = 'menu' id = Column(Integer, primary_key=True, nullable=False, unique=True) parent_id = Column(Integer, ForeignKey('menu.id', onupdate='CASCADE', ondel

[sqlalchemy] How to structure multiple polymorphic association tables

2010-04-25 Thread Timmy
I have a real table A, parent of few non-real polymorphic tables B_i, each with a relationship that points to tables C_i, using a generic id column. There are no foreign keys from A, because the table the id column points to differs depending on a type column. For each of the B_i, I defined a rel

[sqlalchemy] Storing Nested Lists

2010-04-25 Thread greg
Hi All, I'm new to sqlalchemy. I've been reading the documentation and group archives, but can't really find an answer to my question. I suspect it's a question of terminology, and that I don't really know the term for what I'm looking for. Can I map a nested list to one column, and have my nest

[sqlalchemy] Mapping dictionaries with string keys and record values

2010-04-25 Thread Torsten Landschoff
Hi everybody. After reading the documentation on dictionary based collections at , I am wondering if I am the only one who things that this code is intuitive: item = Item() item.notes['color'] = Note('color