[sqlalchemy] Trouble when explicit specify join sequence with alias table

2012-03-06 Thread Liangd
Hi, I have trouble on making a query between two tables: ProcessedDataset - ID ProcDSParent - ThisDataset - ItsParent To find the `Parent` and `Child` of a `Dataset`, I need explicit specify the join sequence between: `ProcessedDataset` -- `ProcDSParent` -- `ProcessedDataset`

Re: [sqlalchemy] Trouble when explicit specify join sequence with alias table

2012-03-06 Thread Michael Bayer
On Mar 6, 2012, at 1:22 AM, Liangd wrote: --- Approach 1: * FromClause.join + expression.select - r_join = dataset r_join.join(child_parent, \ dataset.c.ID == child_parent.c.ThisDataset)

Re: [sqlalchemy] orm query that returns millions of rows

2012-03-06 Thread Michael Bayer
On Mar 6, 2012, at 1:37 AM, Chris Withers wrote: On 02/03/2012 15:59, Michael Bayer wrote: the other recipe is the windowed range query which I normally use for this at http://www.sqlalchemy.org/trac/wiki/UsageRecipes/WindowedRangeQuery, So, this would be the way to go for Microsoft SQL

[sqlalchemy] sqlalchemy seem to save entries to the database in an unordered way

2012-03-06 Thread Amit Marcus
suddenly, i noticed my tables look like this: id is_open event_type_id secondary_type_id customer_id 18 1 2 1 1 59 1 1 1 1 57 1 4 1

Re: [sqlalchemy] sqlalchemy seem to save entries to the database in an unordered way

2012-03-06 Thread Marcin Staryków
Are you sure it's like that? In my base's i have something like id 10 12 543 765 etc. it's because id is global that's why i can't imagine why you have other numbers in the middle... W dniu 6 marca 2012 17:50 użytkownik Amit Marcus mar...@gmail.com napisał: suddenly, i noticed my tables look

[sqlalchemy] Re: sqlalchemy seem to save entries to the database in an unordered way

2012-03-06 Thread Amit Marcus
yep ... i'm 100% sure On Mar 6, 7:01 pm, Marcin Staryków sirman...@gmail.com wrote: Are you sure it's like that? In my base's i have something like id 10 12 543 765 etc. it's because id is global that's why i can't imagine why you have other numbers in the middle... W dniu 6 marca 2012

Re: [sqlalchemy] Re: sqlalchemy seem to save entries to the database in an unordered way

2012-03-06 Thread Michael Bayer
other variables here include: 1. database backend in use, which affects natural ordering of data, note that a relational database table is unordered. That the rows happen to come back in order is an implementation detail. 2. how primary key values are being determined SQLAlchemy's

[sqlalchemy] no prefix appended to column name when using column_property? (version 0.7.5)

2012-03-06 Thread Darren
Hi, In my class definition I use a column_property: clp_price = column_property(Column(clp_price, BigInteger) / scale) The basic idea is that I wanted to apply a scale when the column is retrieved from the database. However, I noticed that the underlying SQL does not prefix this column name

Re: [sqlalchemy] no prefix appended to column name when using column_property? (version 0.7.5)

2012-03-06 Thread Michael Bayer
If the Column is part of a more complex function, as is the case here with the price / scale, SQLAlchemy doesn't dig in to that structure to locate columns, so you would specify the Column by itself separately first: class MyClass(Base): # ... _clp_price_col = Column(clp_price,

Re: [sqlalchemy] no prefix appended to column name when using column_property? (version 0.7.5)

2012-03-06 Thread Michael Bayer
On Mar 6, 2012, at 4:02 PM, Darren wrote: Also, is this the preferred way to scale values? I'd probably use @hybrid_property for this, that way you can define setting the value as well in terms of scale (that is, self.value = given_value * scale) I have some extended blog posts about

[sqlalchemy] Re: sqlalchemy seem to save entries to the database in an unordered way

2012-03-06 Thread Jonathan Vanasco
Assuming you're not seeing this immediately after the INSERT ( which your question doesn't suggest ) IIRC, in order to update in postgres it would delete an entry and replace it at the end of the table's file. So records were inserted in the right order, but could be reordered on an edit. --

[sqlalchemy] Another Question about Selecting with an Association Pattern

2012-03-06 Thread Jonathan Vanasco
In this example, I have 3 classes: Useraccount id name Group id name Useraccount2Group id role_id useraccount_id group_id useraccount= relationship group= relationship With them, I'd like to do the following 2

Re: [sqlalchemy] Trouble when explicit specify join sequence with alias table

2012-03-06 Thread Liang dong
Dear Michael, Appreciate for help me solving this problem. Meanwhile I found something interesting, maybe worth to tell you. Two alias object of same table with same name are treated as conflicts when both using in query. Error 1066, Not unique table/alias is throwing. Many regards, Dong