Re: [sqlalchemy] sqlalchemy - double polymorphic inheritance problem

2010-08-16 Thread jean-philippe serafin
AbstractA is AbstractB base class. AbstractB is ClassA base class Everything work fine in this case. I just want to set 'polymorphic_identity' on each inheritance level if I set by hand : update abstract_a set class_name = 'class_a' : AbstractA.query.first() give me back a

Re: [sqlalchemy] Oracle 8i supports RETURNING clause (but sqla running 8i doesn't)

2010-08-16 Thread Kent Bower
I did find a reference for oracle 8.0 that supports returning clause... I've moved this to a ticket request in trac: http://www.sqlalchemy.org/trac/ticket/1878 On 8/14/2010 11:14 AM, Kent Bower wrote: Not a myth, I'm using them (via sqla). Simple views (just one table) oracle figures out

Re: [sqlalchemy] Updating a Table after changing class based on Declarative in PostgreSQL

2010-08-16 Thread Conor
On 08/15/2010 11:36 AM, mclovin wrote: I am new to SQL and SQLalchemy, but say I have a class like this: class User(Base): __tablename__ = users id = Column(Integer, primary_key=True) name = Column(String, unique=True) join = Column(DateTime) infractions

[sqlalchemy] Set-returning functions

2010-08-16 Thread bekozi
Is it possible to work with set-returning functions in SQLAlchemy without using raw SQL? For example, the PostgreSQL/PostGIS function ST_Dump (http://bit.ly/culek7) returns a “geometry_dump set. Using ST_Dump in raw SQL goes something like: SELECT

[sqlalchemy] Locked file when trying to copy

2010-08-16 Thread Jeroen Dierckx
Hello all, I am trying to export data from a MySQL database to a sqlite database using SqlAlchemy. I am using 2 engines for each database ( from and to ). This is the part that creates the sqlite engine: to_engine = create_engine(u'sqlite:///%s'%temp_file_name) to_meta_data = MetaData()

[sqlalchemy] How to filter by date with SA 0.6?

2010-08-16 Thread Italo Maia
How's the best way to filter a date field by year? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

Re: [sqlalchemy] How to filter by date with SA 0.6?

2010-08-16 Thread Italo Maia
By the way, sqlite here! 2010/8/16 Italo Maia italo.m...@gmail.com How's the best way to filter a date field by year? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To

[sqlalchemy] Re: How to link one table to itself?

2010-08-16 Thread Alvaro Reinoso
It's working properly with that relation: mediaGroup = relationship(MediaGroup, secondary=media_group_groups, order_by=MediaGroup.title, primaryjoin=id==media_group_groups.c.groupA_id, secondaryjoin=id==media_group_groups.c.groupB_id,

Re: [sqlalchemy] Locked file when trying to copy

2010-08-16 Thread Lance Edgar
See http://groups.google.com/group/sqlalchemy/browse_thread/thread/aa9c753384532e6c/8d070ff7208494b1 The solution though I believe is just: from sqlalchemy import create_engine from sqlalchemy.pool import NullPool to_engine = create_engine('sqlite:///%s' % temp_file_name, poolclass=NullPool)

Re: [sqlalchemy] How to filter by date with SA 0.6?

2010-08-16 Thread Lance Edgar
On Mon, 2010-08-16 at 13:01 -0700, Italo Maia wrote: How's the best way to filter a date field by year? Maybe something like: from sqlalchemy import and_ import datetime relevant_year = 1978 query = session.query(MyClass).filter(and_( MyClass.my_date = datetime.date(relevant_year, 1,

[sqlalchemy] Dynamically changing the model

2010-08-16 Thread Eric N
This problem involves Pylons as well, but I believe the problem involves how I'm using SQLAlchemy and therfore I'm posting here first. I have a peculiar situation where I am trying to dynamically flip back and forth between data models and running into problems. I am using PostgreSQL with multiple

[sqlalchemy] Alias for a joined column name

2010-08-16 Thread Michael Hipp
I'm doing something like this where each Item has 2 ForeignKeys to Dealer for buyer and seller: seller = dealers.alias('seller') buyer = dealers.alias('buyer') engine.execute(select([items, seller.c.name, buyer.c.name]).fetchall() When I do this the seller and buyer name end up in the

Re: [sqlalchemy] Alias for a joined column name

2010-08-16 Thread Michael Hipp
On 8/16/2010 5:12 PM, Conor wrote: On 08/16/2010 04:47 PM, Michael Hipp wrote: I'm doing something like this where each Item has 2 ForeignKeys to Dealer for buyer and seller: seller = dealers.alias('seller') buyer = dealers.alias('buyer') engine.execute(select([items, seller.c.name,

Re: [sqlalchemy] Set-returning functions

2010-08-16 Thread Michael Bayer
On Aug 16, 2010, at 11:21 AM, bekozi wrote: Is it possible to work with set-returning functions in SQLAlchemy without using raw SQL? For example, the PostgreSQL/PostGIS function ST_Dump (http://bit.ly/culek7) returns a “geometry_dump set. Using ST_Dump in raw SQL goes something like:

Re: [sqlalchemy] Dynamically changing the model

2010-08-16 Thread Michael Bayer
On Aug 16, 2010, at 4:56 PM, Eric N wrote: This problem involves Pylons as well, but I believe the problem involves how I'm using SQLAlchemy and therfore I'm posting here first. I have a peculiar situation where I am trying to dynamically flip back and forth between data models and running

Re: [sqlalchemy] sqlalchemy - double polymorphic inheritance problem

2010-08-16 Thread Michael Bayer
On Aug 16, 2010, at 4:20 AM, jean-philippe serafin wrote: AbstractA is AbstractB base class. AbstractB is ClassA base class Everything work fine in this case. I just want to set 'polymorphic_identity' on each inheritance level if I set by hand : update abstract_a