[sqlalchemy] Re: Preventing attribute expiration (0.7, ORM)

2011-06-20 Thread Maciej Szumocki
On 17 Cze, 16:20, Michael Bayer mike...@zzzcomputing.com wrote: I usually just turn expire_on_commit = False.      But note also if you just want to do a get(), the actual PK is always present in the key, which is instance_state(myinstance).key[1]. I do want rest of the attributes to

[sqlalchemy] Support for index operator classes in postgresql.

2011-06-20 Thread Filip Zyzniewski - Tefnet
Hi, I've attached a tiny patch which adds support for index specification like this: sqlalchemy.schema.Index('ix_name', 'column', postgresql_ops = {'column': 'text_pattern_ops'}) resulting in: ix_name btree (column text_pattern_ops) Operator classes for indexes are documented here:

[sqlalchemy] Delete a association

2011-06-20 Thread Carlos Mendoza
Hi, I want to remove an association in many to many relation, but I don't want delete the related objects, just the association. If I have: ProjectUser = Table('PROJECT_USER', metadata, Column('id_user', Integer, ForeignKey('USER.id_user')), Column('id_project',Integer,

Re: [sqlalchemy] Re: Preventing attribute expiration (0.7, ORM)

2011-06-20 Thread Michael Bayer
On Jun 20, 2011, at 3:18 AM, Maciej Szumocki wrote: On 17 Cze, 16:20, Michael Bayer mike...@zzzcomputing.com wrote: I usually just turn expire_on_commit = False. But note also if you just want to do a get(), the actual PK is always present in the key, which is

Re: [sqlalchemy] Support for index operator classes in postgresql.

2011-06-20 Thread Michael Bayer
OK maybe a quick test for test/dialect/test_postgresql.py , also does the way the string is being formatted there change the look of existing Index constructs (extra space ?) If you can post as a ticket at http://www.sqlalchemy.org/trac/newticket (log in as guest/guest) else i'll almost

Re: [sqlalchemy] Delete a association

2011-06-20 Thread Michael Bayer
On Jun 20, 2011, at 1:02 AM, Carlos Mendoza wrote: Hi, I want to remove an association in many to many relation, but I don't want delete the related objects, just the association. If I have: ProjectUser = Table('PROJECT_USER', metadata, Column('id_user', Integer,

Re: [sqlalchemy] Re: porting GeoAlchemy to 0.7

2011-06-20 Thread Michael Bayer
looks good, we have ticket http://www.sqlalchemy.org/trac/ticket/2193 to discuss what we're doing here, ill attach there. On Jun 20, 2011, at 12:42 AM, Eric Lemoine wrote: On Thu, Jun 9, 2011 at 7:21 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 9, 2011, at 12:37 PM, Eric

Re: [sqlalchemy] Joining queries with column concatenation.

2011-06-20 Thread Michael Bayer
On Jun 19, 2011, at 6:16 PM, Filip Zyzniewski - Tefnet wrote: Hi, another day and another challenge :). Somehow SQLAlchemy has a problem determining what to join when using concatenation of columns. this: session.query(Locality.name, Street.name).join(Street.locality) properly

Re: [sqlalchemy] Joining queries with column concatenation.

2011-06-20 Thread Michael Bayer
On Jun 20, 2011, at 10:16 AM, Michael Bayer wrote: On Jun 19, 2011, at 6:16 PM, Filip Zyzniewski - Tefnet wrote: Hi, another day and another challenge :). Somehow SQLAlchemy has a problem determining what to join when using concatenation of columns. this:

[sqlalchemy] Help with tricky relationship

2011-06-20 Thread neurino
I have a (deep) tree structure main area category criteria inputs all tables with one_to_many relationships except criteria - inputs which is many_to_many. I need to set up a relationship for `main` as list of all distinct inputs of its sub-sub-sub-criteria as in this query:

[sqlalchemy] fiddley mapping problem

2011-06-20 Thread Chris Withers
Hi All, I have the following table: CREATE TABLE `ip` ( `email` varchar(50) NOT NULL, `ip` varchar(15) NOT NULL, PRIMARY KEY (`email`,`ip`), ) ...which I'm looking to map to the following class: class User: def __init__(self,email,*ips): self.email=email self.ips = ips So,

Re: [sqlalchemy] fiddley mapping problem

2011-06-20 Thread Michael Bayer
On Jun 20, 2011, at 12:21 PM, Chris Withers wrote: Hi All, I have the following table: CREATE TABLE `ip` ( `email` varchar(50) NOT NULL, `ip` varchar(15) NOT NULL, PRIMARY KEY (`email`,`ip`), ) ...which I'm looking to map to the following class: class User: def

Re: [sqlalchemy] fiddley mapping problem

2011-06-20 Thread Chris Withers
On 20/06/2011 17:27, Michael Bayer wrote: So, multiple rows in the `ip` table end up mapping to a single user objects. (ie: I end up with a sequence of ip addresses on user object) How do I do it? I would likely just map traditionally and have User be a non-mapped proxy object to a

Re: [sqlalchemy] fiddley mapping problem

2011-06-20 Thread Michael Bayer
On Jun 20, 2011, at 12:37 PM, Chris Withers wrote: On 20/06/2011 17:27, Michael Bayer wrote: So, multiple rows in the `ip` table end up mapping to a single user objects. (ie: I end up with a sequence of ip addresses on user object) How do I do it? I would likely just map traditionally

[sqlalchemy] dynamically set table_name at runtime

2011-06-20 Thread Cody Django
Hello! I would like to dynamically set/change the table that is mapped in my python object, as instantiated through the declarative style. class Feature(Base, GeometryTableMixIn): this is dynamically created to use a table and pk_column determined at runtime __table_args__ = {

[sqlalchemy] Re: dynamically set table_name at runtime

2011-06-20 Thread Cody Django
Wow somebody already brought this to light! http://stackoverflow.com/questions/2768607/dynamic-class-creation-in-sqlalchemy On Jun 20, 11:36 am, Cody Django codydja...@gmail.com wrote: Hello! I would like to dynamically set/change the table that is mapped in my python object, as

[sqlalchemy] Re: Delete a association

2011-06-20 Thread Carlos Mendoza
Thanks, works great!!! On Jun 20, 10:06 am, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 20, 2011, at 1:02 AM, Carlos Mendoza wrote: Hi, I want to remove an association in many to many relation, but I don't want delete the related objects, just the association. If I have: