[sqlalchemy] Re: Seperate History Tables

2009-03-31 Thread Suha Onay
It is done now. Thank you for all your help. Suha On Mon, Mar 30, 2009 at 17:06, Michael Bayer mike...@zzzcomputing.comwrote: On Mar 30, 2009, at 5:10 AM, Suha Onay wrote: The problem is i defined the history class with the following way (examining the test_versioning file):

[sqlalchemy] Postgres: could not identify an ordering operator for type ... (for SQLA-created table)

2009-03-31 Thread Marcin Krol
Hello everyone, Now that I have my PG db filled, I'm encountering this exception while trying to use it: ProgrammingError: (ProgrammingError) could not identify an ordering operator for type virtualization HINT: Use an explicit ordering operator or modify the query. 'SELECT hosts.id AS

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-31 Thread Yassen Damyanov
On Tue, Mar 31, 2009 at 1:03 AM, Yassen Damyanov yassen@gmail.com wrote: On Mon, Mar 30, 2009 at 5:30 PM, Michael Bayer mike...@zzzcomputing.com wrote: can you produce a small test case illustrating this ? Sure, I'll do my best to produce one for you. Mike, A minimalistic test case

[sqlalchemy] Re: How does query.get() work?

2009-03-31 Thread Dan F
It's not so much that I'm querying but that I get a set of id's from the user and I've got some logic that will often change some of the values. I wanted to take advantage of SA's orm capabilities as opposed to issuing selects and updates. It's possible in the logic that I already have some

[sqlalchemy] Extended Query subclass with add_named_column method

2009-03-31 Thread Bob Farrell
Hello, SQLAlchemy people, So I spoke to jek on IRC to see if there was a way to use add_column without causing the query to return a RowTuple and it doesn't look like there is, so I wrote this: class AdditiveQuery(Query): Extended sqlalchemy.orm.Query class with add_named_column method

[sqlalchemy] Re: How to mix declarative_base with orm.mapper?

2009-03-31 Thread Michael Bayer
a class that doesn't extend your declarative base would have to be mapped explicitly using the mapper() function, otherwise it can't be referenced within a relation(). On Mar 31, 2009, at 8:04 AM, Alex Maslov wrote: Hello, We have been trying to mix a class inherited from

[sqlalchemy] Re: Postgres: could not identify an ordering operator for type ... (for SQLA-created table)

2009-03-31 Thread Michael Bayer
my guess is that its confusing the names virtualization between the table and column name. im guessing the field you send to order_by() is a string otherwise it would render it as tablename.columnname and would be quoted for the upper cased Virtualization. On Mar 31, 2009, at 5:44

[sqlalchemy] Re: Postgres: could not identify an ordering operator for type ... (for SQLA-created table)

2009-03-31 Thread Michael Bayer
my guess is that its confusing the names virtualization between the table and column name. im guessing the field you send to order_by() is a string otherwise it would render it as tablename.columnname and would be quoted for the upper cased Virtualization. On Mar 31, 2009, at 5:44

[sqlalchemy] Re: Extended Query subclass with add_named_column method

2009-03-31 Thread Michael Bayer
wouldn't this be accomplished more simply using contains_eager() ? On Mar 31, 2009, at 9:12 AM, Bob Farrell wrote: Hello, SQLAlchemy people, So I spoke to jek on IRC to see if there was a way to use add_column without causing the query to return a RowTuple and it doesn't look like there

[sqlalchemy] Re: Extended Query subclass with add_named_column method

2009-03-31 Thread Bob Farrell
Yes, if this has been defined on the mapper. Generally I do a lot of just using SQLAlchemy to as a way of writing SQL in Python code that can be passed around for dynamically building up queries so my mappers tend to be quite bare - or are you suggesting this can be done without configuring the

[sqlalchemy] Re: Extended Query subclass with add_named_column method

2009-03-31 Thread Michael Bayer
no, you'd need the mapping to be set up.So yes, if you need to compose your result objects together in some way that is specific to your use case and has no relationship to your mappings or any standard SQLAlchemy feature, you need to either post-process the result of Query or create

[sqlalchemy] Re: How to mix declarative_base with orm.mapper?

2009-03-31 Thread Alexey Maslov
Michael, Thanks for the reply. Sorry, I am incredibly stupid for having forgotten to replace 'object' with Base. Anyway, after I have inherited Country from Base it looks like SQLAlchemy cannot detect the relation: URL: http://localhost:5010/pages/subscribe/ File

[sqlalchemy] Re: How to mix declarative_base with orm.mapper?

2009-03-31 Thread Michael Bayer
user_profiles_tbl and your declarative_meta need to share same MetaData instance. On Mar 31, 2009, at 9:56 AM, Alexey Maslov wrote: Michael, Thanks for the reply. Sorry, I am incredibly stupid for having forgotten to replace 'object' with Base. Anyway, after I have inherited

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-31 Thread Michael Bayer
the stack trace would have said it all on this one, its just autoflush. fixed in r5875. On Mar 31, 2009, at 7:01 AM, Yassen Damyanov wrote: On Tue, Mar 31, 2009 at 1:03 AM, Yassen Damyanov yassen@gmail.com wrote: On Mon, Mar 30, 2009 at 5:30 PM, Michael Bayer

[sqlalchemy] Re: How to mix declarative_base with orm.mapper?

2009-03-31 Thread Alexey Maslov
Thanks, it works when I added the MetaData instance to the declarative_meta() call. Have a great day! Regards, Alexey Maslov On Tue, Mar 31, 2009 at 6:02 PM, Michael Bayer mike...@zzzcomputing.comwrote: user_profiles_tbl and your declarative_meta need to share same MetaData instance. On

[sqlalchemy] SqlSoup joins broken in 0.5.3

2009-03-31 Thread Stu.Axon
Heres some input that used to work, and the error that now happens from sqlalchemy.ext.sqlsoup import SqlSoup, MetaData db_uri = 'postgres://user:passw...@127.0.0.1/games' db = SqlSoup(db_uri) db.devmap_device.join(db.devmap_manufacturer, db.devmap_device.manufacturer_id ==

[sqlalchemy] Using SQLAlchemy to build sql files (without execution)

2009-03-31 Thread Maxim Khitrov
Hello all, I'm working on a project for which I need to create sql files (the sort that you get from a database dump) without actually connecting to any database. The resulting code must be compatible with MySQL. My first inclination was to write a bunch of functions that contain sql code

[sqlalchemy] Re: SqlSoup joins broken in 0.5.3

2009-03-31 Thread Jonathan Ellis
You can't just throw filter expressions into the join call in modern sqla. Try db.devmap_device.join(db.devmap_manufacturer).filter(db.devmap_device.manufacturer_id == db.devmap_manufacturer.id).first() -Jonathan On Tue, Mar 31, 2009 at 8:23 AM, Stu.Axon stu.a...@gmail.com wrote: Heres some

[sqlalchemy] Re: Postgres: could not identify an ordering operator for type ... (for SQLA-created table)

2009-03-31 Thread Marcin Krol
Michael Bayer wrote: my guess is that its confusing the names virtualization between the table and column name. im guessing the field you send to order_by() is a string Correct. I really have not much choice in the matter without somewhat tedious programming, because column for order

[sqlalchemy] Re: SqlSoup joins broken in 0.5.3

2009-03-31 Thread Michael Bayer
oh, you could send that as a tuple to join, i.e. db.devmap_device.join((db.devmap_manufacturer, db.devmap_device.manufacturer_id == db.devmap_manufacturer.id)).first() this because join() accepts a list of join conditions, a composite condition is sent as a tuple. On Mar 31, 2009, at

[sqlalchemy] Re: Postgres: could not identify an ordering operator for type ... (for SQLA-created table)

2009-03-31 Thread Michael Bayer
On Mar 31, 2009, at 11:13 AM, Marcin Krol wrote: So there's a humble request/proposal from me for you: would it be possible for SQLA to always quote column names in ORDER BY clauses for PG backend, even when it's a string? In the meantime I will probably just rename the columns to

[sqlalchemy] Re: Getting FlushError trying to merge related objects

2009-03-31 Thread Yassen Damyanov
On Tue, Mar 31, 2009 at 6:03 PM, Michael Bayer mike...@zzzcomputing.com wrote: the stack trace would have said it all on this one, its just autoflush.  fixed in r5875. Works like a charm with r5875; thank you, Mike! Y. --~--~-~--~~~---~--~~ You received this

[sqlalchemy] Re: Using SQLAlchemy to build sql files (without execution)

2009-03-31 Thread Yassen Damyanov
Max, I am an SA newbie so you should not take my words too seriously. So here's what I think: First, the only way to know and be sure that your code runs fine is to run it against a real database server. MySQL is not that hard to set up. (If you need help for that, let me know, I can help.)

[sqlalchemy] Re: Using SQLAlchemy to build sql files (without execution)

2009-03-31 Thread az
you can use echo=True to metadata and/or logging to some extent. there was also some recipe about how to print some query's actual sql without issuing it, see recipes section at the site. but i'm not sure u can really do all you want without having a responding DB-api (which will at some point

[sqlalchemy] Re: Using SQLAlchemy to build sql files (without execution)

2009-03-31 Thread Yassen Damyanov
On Mar 31, 2009, Maxim Khitrov mkhit...@gmail.com wrote: I should also mention that I'm using Python 2.6 on Windows. The latest stable MySQL-Python extension doesn't support 2.6, and there doesn't seem to be a test version available for Windows. The 1.2.2 Windows version of mysql-python

[sqlalchemy] Re: SQLAlchemy 0.5.3 released

2009-03-31 Thread David Gardner
I noticed a significant performance increase between 0.5.2 and 0.5.3. While tracking down an unrelated issue I had written a dummy test that ran some SA code inside of a for i in range(1000): and going from 0.5.2 and 0.5.3 execution went from 14minutes to 12minutes. Keep in mind this was a