[sqlalchemy] Cannot delete persisted object which is not in current session

2008-06-30 Thread Tai Tran
I'm using SQLAlchemy 0.4.6 with Python 2.5.2, and having a problem with deleting object. Below is the testing code that shows my problem: from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('sqlite:///C:/test_db.sqlite') Session = sessionmaker(bind=engine,

[sqlalchemy] Re: Implementation patterns for initializing the model and obtaining the mappers

2008-06-30 Thread Michael Bayer
On Jun 30, 2008, at 1:27 AM, Andreas Jung wrote: --On 29. Juni 2008 16:57:16 -0400 Michael Bayer [EMAIL PROTECTED] wrote: On Jun 29, 2008, at 12:46 PM, Andreas Jung wrote: This approach is ugly (because of putting the mapper within the local scope into the global scope (in order

[sqlalchemy] Re: Cannot delete persisted object which is not in current session

2008-06-30 Thread Michael Bayer
On Jun 30, 2008, at 4:37 AM, Tai Tran wrote: # Create a new Foo object, then save it to the database db_session = Session() f = Foo('001') db_session.save(f) db_session.commit() # Try deleting Foo object created above with a new, different session db_session2 =

[sqlalchemy] custom type for PostGIS geometry

2008-06-30 Thread Hans
Hi, Based on some posts I was able to find scouring Google, I was trying to implement a custom type (GeometryType) for the PostGIS GEOMETRY column. Now, I should point out that I am not using sqlalchemy to build the DDL, since the geometry columns are indirectly created by invoking stored

[sqlalchemy] Following docs but can't get logging to work as expected

2008-06-30 Thread Russell Warren
I must be missing something simple, but with SQLA 0.4.6 I can't get the logging to work without using the echo flag. When I do set echo = True and leave my logging configuration code I get the double logging problem mentioned in the docs. My apologies if this is just a logging module issue.

[sqlalchemy] Re: custom type for PostGIS geometry

2008-06-30 Thread Michael Bayer
On Jun 30, 2008, at 1:04 PM, Hans wrote: The problem is that I'd like to have sqlalchemy return KML for all geometry types by default, but I don't know how to setup my type to specify a SQL function that needs to be applied to the column in the select clause. Is this possible?

[sqlalchemy] Re: custom type for PostGIS geometry

2008-06-30 Thread Hans
On Jun 30, 1:24 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 30, 2008, at 1:04 PM, Hans wrote: The problem is that I'd like to have sqlalchemy return KML for all geometry types by default, but I don't know how to setup my type to specify a SQL function that needs to be applied to

[sqlalchemy] Order_by

2008-06-30 Thread laureano arcanio
Hi guys, I'm new to this list but I I'm using SA from a while ago. I'm wondering how to sort a query based on a child table attribute. Table A- Many to One - Table B. I need to make a query in A, then order those records by a property of B. query = session.query(A).order_by( B.something )

[sqlalchemy] subtle AttributeError in 0.4.5

2008-06-30 Thread matt harrison
Folks- I'm (seemingly) randomly running across this issue in my pylons/SA app. I'm generating a SQL where clause like so: where = sa.and_(cal_table.c.adweekid == table.c.adweekid, ) and every so often I'll get an attribute error in sqlalchemy.util:494 in __getattr__ type

[sqlalchemy] Re: subtle AttributeError in 0.4.5

2008-06-30 Thread Michael Bayer
On Jun 30, 2008, at 4:41 PM, matt harrison wrote: Folks- I'm (seemingly) randomly running across this issue in my pylons/SA app. I'm generating a SQL where clause like so: where = sa.and_(cal_table.c.adweekid == table.c.adweekid, ) and every so often I'll get an attribute error

[sqlalchemy] Re: subtle AttributeError in 0.4.5

2008-06-30 Thread matt harrison
On Jun 30, 2:46 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jun 30, 2008, at 4:41 PM, matt harrison wrote: Folks- I'm (seemingly) randomly running across this issue in my pylons/SA app. I'm generating a SQL where clause like so: where = sa.and_(cal_table.c.adweekid ==

[sqlalchemy] Re: MySQL 5.0 DateTime initialization during Table creation is failing.

2008-06-30 Thread Gloria W
I thought this was a scope problem, but it seems to be even bigger. This is the error I get: OperationalError: (OperationalError) (1067, Invalid default value for 'date_created') u'\nCREATE TABLE fu_op_requests (\n \tfu_op_requests_id INTEGER NOT NULL AUTO_INCREMENT, \n\tname VARCHAR(50),

[sqlalchemy] Re: MySQL 5.0 DateTime initialization during Table creation is failing.

2008-06-30 Thread Michael Bayer
running this script: import sqlalchemy from sqlalchemy.databases import mysql engine = sqlalchemy.create_engine('mysql://scott:[EMAIL PROTECTED]/ test', echo=True) metadata = sqlalchemy.MetaData(engine) purchases_table = sqlalchemy.Table('fu_op_purchases',metadata,

[sqlalchemy] Re: Order_by

2008-06-30 Thread laureano arcanio
I found the solution using Joins. Thanks anyways. This is it: query = session.query(A).select_from(join(A, B)).order_by(B.some_attr) cheers --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post