[sqlalchemy] Re: Select from multiple databases

2009-10-02 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of kkapron > Sent: 01 October 2009 21:27 > To: sqlalchemy > Subject: [sqlalchemy] Select from multiple databases > > > Hello, I'm a beginner in sqlalchemy and I've got a problem wit

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Christian Démolis > Sent: 01 October 2009 10:40 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Bypass checking to database structure > (metadata.create_all) > > Hi aga

[sqlalchemy] Re: unexpected chained relations and "append" behaviour

2009-09-24 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Crusty > Sent: 24 September 2009 16:16 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: unexpected chained relations and > "append" behaviour > > > Hello Simon, >

[sqlalchemy] Re: unexpected chained relations and "append" behaviour

2009-09-23 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Crusty > Sent: 23 September 2009 15:48 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] unexpected chained relations and > "append" behaviour > > > Hello everyone, > >

[sqlalchemy] Re: Pre-commit validation spanning multiple tables/ORM classes

2009-09-22 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Randall Nortman > Sent: 22 September 2009 16:31 > To: sqlalchemy > Subject: [sqlalchemy] Pre-commit validation spanning multiple > tables/ORM classes > [SNIP] > > So if I do t

[sqlalchemy] Re: getting data from primary keys

2009-09-15 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of C.T. Matsumoto > Sent: 15 September 2009 07:21 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: getting data from primary keys > > That did the trick. > > Thanks a l

[sqlalchemy] Re: How to bypass scoped_session?

2009-09-09 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Eloff > Sent: 08 September 2009 21:34 > To: sqlalchemy > Subject: [sqlalchemy] Re: How to bypass scoped_session? > > > On Sep 8, 3:47 am, &

[sqlalchemy] Re: How to bypass scoped_session?

2009-09-08 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Eloff > Sent: 08 September 2009 04:40 > To: sqlalchemy > Subject: [sqlalchemy] How to bypass scoped_session? > > > Hi, > > I'm using scoped_session in my pylons app, but sometim

[sqlalchemy] Re: Curious Problem

2009-09-02 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of gizli > Sent: 02 September 2009 04:45 > To: sqlalchemy > Subject: [sqlalchemy] Curious Problem > > > Hi all, > > I just discovered something weird when doing concurrency testing

[sqlalchemy] Re: from a sqlalchemy table to the corresponding CREATE TABLE sql code

2009-08-26 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Michele Simionato > Sent: 26 August 2009 13:40 > To: sqlalchemy > Subject: [sqlalchemy] from a sqlalchemy table to the > corresponding CREATE TABLE sql code > > > A part from se

[sqlalchemy] Re: Tracking Last Update timestamp for models

2009-08-25 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Stephen Hansen > Sent: 25 August 2009 07:34 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Tracking Last Update timestamp for models > > Hi all. > > I'm working on co

[sqlalchemy] Re: ForeignKey on a ForeignKey

2009-08-24 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of asrenzo > Sent: 24 August 2009 13:48 > To: sqlalchemy > Subject: [sqlalchemy] Re: ForeignKey on a ForeignKey > > > Hi King Simon, > > Thanks for your answer but this doesn't sol

[sqlalchemy] Re: ForeignKey on a ForeignKey

2009-08-24 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Laurent Rahuel > Sent: 24 August 2009 12:16 > To: sqlalchemy > Subject: [sqlalchemy] ForeignKey on a ForeignKey > > > Hi all, > > I'm stucked with a problem I'm not able to solv

[sqlalchemy] Re: negative indexes in query slices?

2009-08-24 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of john smallberries > Sent: 24 August 2009 08:51 > To: sqlalchemy > Subject: [sqlalchemy] negative indexes in query slices? > > > I just tried limiting a query to the final 10 item

[sqlalchemy] Re: table creation oddity

2009-08-21 Thread King Simon-NFHD78
Faheem Mitha wrote: > Thanks for the fast and helpful response. This looks like an artifact of > how I am creating the table. I wonder if this would still show up if I > explicitly specified the id. I could check this. Also, presumably if I had > other cols in the table, they wouldn't show up i

[sqlalchemy] Re: index in SA

2009-08-21 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 > Sent: 21 August 2009 10:25 > To: sqlalchemy > Subject: [sqlalchemy] Re: index in SA > > > i tried > > class MyClass: >__tablename__ = 'my_table' > > id

[sqlalchemy] Re: new questions

2009-08-21 Thread King Simon-NFHD78
darkblueB wrote: > > ok, I have done this > I have an object def and a __table__ for all of the "main actors" in > my setup > I defined an __init__() for one of them > I use the declarative base > > when the objects get created, they seem to have a __mapper__ in them > already > (the "primary map

[sqlalchemy] Re: index in SA

2009-08-21 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 > Sent: 21 August 2009 07:30 > To: sqlalchemy > Subject: [sqlalchemy] Re: index in SA > > > i want to add a composite index to the class inherited from > declarativ

[sqlalchemy] Re: table creation oddity

2009-08-21 Thread King Simon-NFHD78
Faheem Mitha wrote: > > Hi, > > The following script is then followed by its output, and > finally by the > table output. > > I don't get what is going on here. Yes, I should commit the > session, and > the table is empty as expected, but why does the id keep > incrementing on > successiv

[sqlalchemy] Re: new questions

2009-08-19 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of darkblueB > Sent: 19 August 2009 02:58 > To: sqlalchemy > Subject: [sqlalchemy] Re: new questions > > Hi Simon > > thanks for the reply.. Your second part is straightforward.. >

[sqlalchemy] Re: renaming columns

2009-08-17 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Michele Simionato > Sent: 17 August 2009 16:11 > To: sqlalchemy > Subject: [sqlalchemy] renaming columns > > > There should be an easy way to do this, but I cannot find it in the

[sqlalchemy] Re: new questions

2009-08-17 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of darkblueB > Sent: 17 August 2009 06:31 > To: sqlalchemy > Subject: [sqlalchemy] new questions > > > Hi- > I have just read a lot and gone through some exercises, but am at an >

[sqlalchemy] Re: Backrefs and the identity map

2009-08-03 Thread King Simon-NFHD78
Michael Bayer wrote: > > King Simon-NFHD78 wrote: > > > > to > > > > master_id = sa.Column(sa.Integer, > > sa.ForeignKey(Master.__table__.c.id)) > > > > ...and now it seems to work! So is this a bug? > > yes, that would be a bug. There

[sqlalchemy] Re: Backrefs and the identity map

2009-08-03 Thread King Simon-NFHD78
I wrote: > Hi, > > Does accessing a backref always have to issue SQL, even if > the object to > be loaded already exists in the identity map? For example, if I have a > many-to-one lazy-loaded relationship from Master to Detail with a > backref, the statement "master.details[0].master" will issu

[sqlalchemy] Backrefs and the identity map

2009-08-03 Thread King Simon-NFHD78
Hi, Does accessing a backref always have to issue SQL, even if the object to be loaded already exists in the identity map? For example, if I have a many-to-one lazy-loaded relationship from Master to Detail with a backref, the statement "master.details[0].master" will issue SQL for the '.master'

[sqlalchemy] Re: Session mapper and Class.query() method

2009-07-27 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of naktinis > Sent: 27 July 2009 13:07 > To: sqlalchemy > Subject: [sqlalchemy] Session mapper and Class.query() method > > > I've seen that Session.mapper is deprecated. While I ag

[sqlalchemy] Re: autoload of db view treating columns as Decimal

2009-07-23 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Randy Syring > Sent: 23 July 2009 07:23 > To: sqlalchemy > Subject: [sqlalchemy] Re: autoload of db view treating > columns as Decimal > > > Well, I am not really sure what the

[sqlalchemy] Re: Dynamic making of the where clause

2009-06-26 Thread King Simon-NFHD78
> On Jun 23, 3:32 pm, Ash wrote: > > Hello, > > > > I am tryin to make the dynamic where clause using > append_whereclause. > > > > But how i can do that,  For eg : > > > > I have a==b and c in (1,2,3,4) or d like %s > > > > So i made three sqlalchemy expression > > > > 1. a==b > > 2. c in (1,2,

[sqlalchemy] Re: aggregation with count and webhelpers.paginate

2009-06-22 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Hollister > Sent: 20 June 2009 02:15 > To: sqlalchemy > Subject: [sqlalchemy] Re: aggregation with count and > webhelpers.paginate > > > Well, that worked great: > > q = me

[sqlalchemy] Re: SqlAlchemy reflection error in TurboGears 2

2009-06-04 Thread King Simon-NFHD78
Mike Driscoll wrote: > > Well, I did the fake id column because SA was throwing an error on a > the reflected table since it didn't have a primary key defined. I > think I may have found a workaround though. >From SA's point of view, the primary key just has to be a set of columns that uniquely

[sqlalchemy] Re: Query -> column names

2009-06-04 Thread King Simon-NFHD78
George Sakkis wrote: > > Is there a (public) API for getting the column names of a given Query > instance and other similar introspection needs ? I didn't find > anything related in the docs but after digging in the code I came up > with > col_names = [e._result_label for e in q._entities] >

[sqlalchemy] Re: This join does not fill in the collection

2009-05-28 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Marcin Krol > Sent: 28 May 2009 13:57 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: This join does not fill in the collection > > > Hello Simon, > > This answere

[sqlalchemy] Re: This join does not fill in the collection

2009-05-28 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Marcin Krol > Sent: 28 May 2009 10:09 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] This join does not fill in the collection > > > Hello everyone, > > session.query

[sqlalchemy] Re: mapping class against arbitrary SQL expression

2009-04-17 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of JanW > Sent: 17 April 2009 14:45 > To: sqlalchemy > Subject: [sqlalchemy] Re: mapping class against arbitrary SQL > expression > > > OK, thanks, > > it does work if you make an

[sqlalchemy] Re: mapping class against arbitrary SQL expression

2009-04-17 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of JanW > Sent: 17 April 2009 13:18 > To: sqlalchemy > Subject: [sqlalchemy] mapping class against arbitrary SQL expression > > > Hi, > > is there a way to map a class against an a

[sqlalchemy] Re: Insertion issues

2009-04-03 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Tanmoy > Sent: 03 April 2009 14:30 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: Insertion issues > > import sqlalchemy > from sqlalchemy import * > > engine = cr

[sqlalchemy] Re: "Class.query" vs "DBSession.query(Class)"

2009-02-27 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Sanjay > Sent: 27 February 2009 05:52 > To: sqlalchemy > Subject: [sqlalchemy] "Class.query" vs "DBSession.query(Class)" > > > Hi, > > There are two styles of writing code for q

[sqlalchemy] Re: Creating SQL Expression

2009-02-25 Thread King Simon-NFHD78
Could you use the python 'operator' module (http://docs.python.org/library/operator.html)? Eg. (untested): import operator operations = { '+': operator.add, '-': operator.sub, # etc. } def combine_columns(op, *cols): return operations[op](*cols) sum_column = combine_columns('

[sqlalchemy] Re: Separating session and db/models definitions

2009-02-25 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of bsdemon > Sent: 24 February 2009 20:22 > To: sqlalchemy > Subject: [sqlalchemy] Separating session and db/models definitions > > > Hello. > > I have the following states of thin

[sqlalchemy] Re: altering tables

2009-02-11 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of > mhearne808[insert-at-sign-here]gmail[insert-dot-here]com > Sent: 10 February 2009 19:13 > To: sqlalchemy > Subject: [sqlalchemy] altering tables > [snip] > > I'd like to upd

[sqlalchemy] Re: classes in separate files

2009-02-09 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of camlost > Sent: 09 February 2009 09:18 > To: sqlalchemy > Subject: [sqlalchemy] classes in separate files > > > Hi, could someone advice me, please, how to split classes into > i

[sqlalchemy] Re: polymorphic_identity not allowed to be zero for base class?

2009-01-30 Thread King Simon-NFHD78
e zero for base class? > > > > On Jan 30, 2009, at 12:19 PM, King Simon-NFHD78 wrote: > > > > > Would None (ie. SQL NULL) be a valid polymorphic identity? > > it becomes that issue where we just need some kind of constant to > represent THIS_IS_NOT_DEFINED, so tha

[sqlalchemy] Re: polymorphic_identity not allowed to be zero for base class?

2009-01-30 Thread King Simon-NFHD78
Would None (ie. SQL NULL) be a valid polymorphic identity? > -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Michael Bayer > Sent: 30 January 2009 17:06 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: polymorphic_i

[sqlalchemy] Re: Using orderedlist with a secondary table

2009-01-30 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Nathan Harmston > Sent: 30 January 2009 13:15 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Using orderedlist with a secondary table > > Hi, > > I am currently tryin

[sqlalchemy] Re: the return type of conn.execute(text(""))

2009-01-28 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha > Sent: 27 January 2009 22:41 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] the return type of conn.execute(text("")) > > > > Hi, > > Today I attempted

[sqlalchemy] Re: passing tuple argument into sqlalchemy.sql.text string

2009-01-21 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Faheem Mitha > Sent: 20 January 2009 22:05 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] passing tuple argument into > sqlalchemy.sql.text string > > > > Hi, > > I

[sqlalchemy] Re: how to use model.py file across different applications

2009-01-20 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of abhishek > Sent: 20 January 2009 14:26 > To: sqlalchemy > Subject: [sqlalchemy] how to use model.py file across > different applications > > > Hello all, > > I have been using

[sqlalchemy] Re: SQLAlchemy 0.5 Released

2009-01-09 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of a...@svilendobrev.com > Sent: 08 January 2009 19:11 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: SQLAlchemy 0.5 Released > > > On Thursday 08 January 2009 21:03:

[sqlalchemy] Re: Efficient dictificationof result sets

2008-12-19 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Andreas Jung > Sent: 19 December 2008 06:30 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: Efficient dictificationof result sets > > On 19.12.2008 2:57 Uhr, Michael

[sqlalchemy] Re: Create tables with metadata

2008-12-12 Thread King Simon-NFHD78
SQLALchemy doesn't (directly) contain functions for altering tables. You may be interested in the sqlalchemy-migrate project: http://code.google.com/p/sqlalchemy-migrate/ The first example on this page shows how to add a column: http://code.google.com/p/sqlalchemy-migrate/wiki/MigrateChange

[sqlalchemy] Re: returning primary key of object without know what it is called.

2008-12-05 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Faheem Mitha > Sent: 04 December 2008 20:43 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] returning primary key of object without > know what it is called. > > > > Hi, > > I'

[sqlalchemy] Re: New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat

2008-11-28 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Doug Farrell > Sent: 28 November 2008 18:22 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] New instance ExtraStat with identity > key (...) conflicts with persistent instance Extr

[sqlalchemy] Re: ORM mapping with Elixir compared to raw cursor query

2008-11-21 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of SinJax > Sent: 21 November 2008 10:43 > To: sqlalchemy > Subject: [sqlalchemy] Re: ORM mapping with Elixir compared to > raw cursor query > [SNIP] > sql = """ > SELECT annotations.id AS a

[sqlalchemy] Re: Info needed regarding the use of cascade

2008-11-18 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of > ---"<[EMAIL PROTECTED]>"@il06exr02.mot.com > Sent: 18 November 2008 10:04 > To: sqlalchemy > Subject: [sqlalchemy] Re: Info needed regarding the use of cascade > > > > Thank you Michael

[sqlalchemy] Re: Using deferred with declarative

2008-11-14 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Allen Bierbaum > Sent: 14 November 2008 16:40 > To: sqlalchemy > Subject: [sqlalchemy] Re: Using deferred with declarative > > > Does anyone have any ideas on this? > > Does declarative si

[sqlalchemy] Re: select where field=max(field)

2008-11-11 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of John Hunter > Sent: 11 November 2008 01:54 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: select where field=max(field) > > > On Mon, Nov 10, 2008 at 11:10 AM, Michael Bayer >

[sqlalchemy] Re: select where field=max(field)

2008-11-10 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of John Hunter > Sent: 10 November 2008 15:29 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: select where field=max(field) > > > On Mon, Nov 10,

[sqlalchemy] Re: select where field=max(field)

2008-11-10 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of John Hunter > Sent: 10 November 2008 14:07 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: select where field=max(field) > > > On Mon, Nov 10,

[sqlalchemy] Re: select where field=max(field)

2008-11-10 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of John Hunter > Sent: 08 November 2008 05:09 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: select where field=max(field) > [SNIP] > Here is a query that lists the sum(pnl) fo

[sqlalchemy] Re: Memory leak - is session.close() sufficient?

2008-11-10 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of joelanman > Sent: 10 November 2008 00:21 > To: sqlalchemy > Subject: [sqlalchemy] Re: Memory leak - is session.close() sufficient? > > > Thanks for all the advice - I've changed my unicode

[sqlalchemy] Re: how to print a constructed query with it's parameters?

2008-10-15 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of alex bodnaru > Sent: 15 October 2008 11:00 > To: SQLAlchemy > Subject: [sqlalchemy] how to print a constructed query with > it's parameters? > > > hello friends, > > in order to debug my

[sqlalchemy] Re: How to turn off UPDATE on child objects when deleting parent object

2008-09-30 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Randy Syring > Sent: 30 September 2008 07:17 > To: sqlalchemy > Subject: [sqlalchemy] Re: How to turn off UPDATE on child > objects when deleting parent object > > On Sep 30, 2:14 am, Randy

[sqlalchemy] Re: M2M relationship

2008-07-14 Thread King Simon-NFHD78
Heston wrote: > [SNIP] > > Above you talk about a global module in the application which > creates the > Base and metadata, but I don't understand how these can then > be accessed by > other classes around the application? > > Do you have any good sample code or a link to a decent > tutorial?

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

2008-07-01 Thread King Simon-NFHD78
Tai Tran wrote: > > [snip] > > class PC(object): > > ... > > def destroySelf(self): > db_session = Session() > ... > for port in self.ports: > port.destroySelf() > ... > db_session.delete(self) > > ... > > > class Port(object):

[sqlalchemy] Re: sharding id_chooser query_chooser

2008-06-27 Thread King Simon-NFHD78
Lilo wrote: > > My understanding of this query_chooser is that it's used when you want > to execute orm's sql rather than raw sql. > > I don't quite understand what is visit_binary function do from > attribute_shard.py example. What does it mean binary.operator, > binary.left, binary.right.clau

[sqlalchemy] Re: text

2008-06-11 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jack2318 > Sent: 11 June 2008 17:50 > To: sqlalchemy > Subject: [sqlalchemy] text > > > I tried very simple test: > > s = text("SELECT COUNT(*) FROM table WHERE field LIKE 'something'") > cou

[sqlalchemy] Re: select db engine with create_session

2008-06-10 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of lilo > Sent: 10 June 2008 17:23 > To: sqlalchemy > Subject: [sqlalchemy] select db engine with create_session > > > can someone tell me how session chooses the right db engine to insert > r

[sqlalchemy] Re: sqlalchemy in virtualenv Instructions

2008-06-10 Thread King Simon-NFHD78
Lukasz Szybalski wrote: > > > I have mysqldb installed in the system wide install how do I tell > virtualenv to use it? > I don't see a need to install it in virtualenv again so I guess I just > have to givea right path? How, and in which file? > > Thanks, > Lucas > > > File > "/usr/local/p

[sqlalchemy] Re: Pre-commit hooks

2008-05-14 Thread King Simon-NFHD78
Yannick Gingras wrote: > Greetings Alchemists, > Is it possible to define a hook in a mapped class that will > be called > to test the sanity of an instance before it gets committed? > > As an example: > > class Item(object): > def _pre_commit(self): > assert (self.dry_weight + se

[sqlalchemy] Re: schema changes

2008-02-14 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Chris Withers > Sent: 13 February 2008 13:51 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: schema changes > > > Michael Bayer wrote: > > > >> What if they exist but don't m

[sqlalchemy] Re: Search in object list by field value

2008-02-08 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of maxi > Sent: 08 February 2008 14:30 > To: sqlalchemy > Subject: [sqlalchemy] Re: Search in object list by field value > > > Thanks Simon, > I was doing of that manner. > > Now, is advisabl

[sqlalchemy] Re: Search in object list by field value

2008-02-08 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of maxi > Sent: 08 February 2008 13:47 > To: sqlalchemy > Subject: [sqlalchemy] Re: Search in object list by field value > > > On 8 feb, 09:58, svilen <[EMAIL PROTECTED]> wrote: > > On Friday

[sqlalchemy] Re: How do I Instantiate a class with an Auto-assigned Key ID

2008-02-04 Thread King Simon-NFHD78
Hi, If your database is set up to generate auto-incrementing primary keys on INSERT (such as a MySQL auto-incrementing column), then SA will retrieve the new value when the object is flushed to the database. When the object is constructed, the primary key will be None until you flush the session,

[sqlalchemy] Re: Two SqlAlchemy versions installed together

2008-01-23 Thread King Simon-NFHD78
If you're using easy_install to install them, you should be able to install them with the '-m' (--multiversion) switch. See: http://peak.telecommunity.com/DevCenter/EasyInstall#command-line-options Choosing the version you want to use in your application is then done like this: import pkg_resou

[sqlalchemy] Re: Filter by year in datetime column

2008-01-18 Thread King Simon-NFHD78
Would "create_date >= '2007-01-01' and create_date < '2008-01-01'" be acceptable? If so, something like this should work from sqlalchemy import and_ from datetime import date data = Table.query().filter(and_([Mikropost.c.create_date >= date(2007, 1, 1), Mikropo

[sqlalchemy] Re: Schema display

2008-01-07 Thread King Simon-NFHD78
sqlalchemy_schemadisplay.py is not part of the SQLAlchemy distribution - it's a separate script attached to that wiki page. You can download it from the link at the bottom of the page. Hope that helps, Simon > -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROT

[sqlalchemy] Re: Convert JOIN to WHERE for old MySQLs

2007-12-12 Thread King Simon-NFHD78
Michael Bayer wrote > On Dec 12, 2007, at 9:04 AM, King Simon-NFHD78 wrote: > > > > > Hi, > > > > I'm connecting to an ancient version of MySQL (3.23.58) > that (as far > > as > > I can tell) doesn't support basic "JOIN ON >

[sqlalchemy] Re: Convert JOIN to WHERE for old MySQLs

2007-12-12 Thread King Simon-NFHD78
Jason kirtland wrote: > > King Simon-NFHD78 wrote: > > Hi, > > > > I'm connecting to an ancient version of MySQL (3.23.58) > that (as far as > > I can tell) doesn't support basic "JOIN ON > " syntax > > > > Ie. th

[sqlalchemy] Re: Column defaults in MapperExtension.after_insert

2007-12-12 Thread King Simon-NFHD78
Michael Bayer wrote: > On Dec 11, 2007, at 10:07 AM, King Simon-NFHD78 wrote: > > > > > I assume the problem is that my date_created column isn't > immediately > > available at the 'after_insert' stage, because it is > generated in the > > S

[sqlalchemy] Re: LIMIT in queries

2007-12-12 Thread King Simon-NFHD78
Felix Schwarz wrote: > Hi, > > after reading the docs [1] I thought that something like > session.query(User).filter(User.c.id > 3)[0] > should work even if the filter clause does not return any rows. > > But - compliant with Python's behavior - SQLAlchemy raises an > IndexError. > (...) >Fi

[sqlalchemy] Convert JOIN to WHERE for old MySQLs

2007-12-12 Thread King Simon-NFHD78
Hi, I'm connecting to an ancient version of MySQL (3.23.58) that (as far as I can tell) doesn't support basic "JOIN ON " syntax Ie. this gives a syntax error: SELECT * FROM productversions pv JOIN producttypes pt ON pv.producttype = pt.producttype Whereas this is fine: SELECT * FROM pr

[sqlalchemy] Column defaults in MapperExtension.after_insert

2007-12-11 Thread King Simon-NFHD78
svilen wrote: > > On Tuesday 11 December 2007 13:13:37 King Simon-NFHD78 wrote: > > Hi, > > > > I used to be able to iterate over mapper.properties.items() to get > > the name of each mapped property along with the object that > > implements it. However, in 0

[sqlalchemy] Iterating over mapped properties

2007-12-11 Thread King Simon-NFHD78
Hi, I used to be able to iterate over mapper.properties.items() to get the name of each mapped property along with the object that implements it. However, in 0.4.1, trying to do this results in a NotImplementedError telling me to use iterate_properties and get_property instead, but I can't see a

[sqlalchemy] Re: Matching a DateTime-field

2007-12-11 Thread King Simon-NFHD78
It may not matter to you, but I wouldn't have thought this would be a very efficient query, because the database is going to have to call the DATE_FORMAT function twice for every row in your table. I would have thought a more efficient version would be one that asks for all rows between the first

[sqlalchemy] Re: IMPORTANT: Does SA caches objects in memory forever?

2007-12-07 Thread King Simon-NFHD78
Felix Schwarz wrote: > > I have a question which I think is similar enough to be asked > in the same > thread: I have a set of quite simple migration scripts which > us SQLAlchemy 0.4 > and Elixir 0.4. I do extract data from the old legacy (MySQL) > database with > SQLAlchemy and put this da

[sqlalchemy] Re: concurent modification

2007-11-28 Thread King Simon-NFHD78
imgrey wrote: > > Based on my observations it happens only with concurent inserts/ > updates. > One thread : > > {{{ > f_table.insert().execute() > session.flush() > transaction = session.begin() > nested = session.begin_nested() > try: > f_table.insert().execute() > except IntegrityError: >

[sqlalchemy] Re: fully qualified column names in RowProxy

2007-11-27 Thread King Simon-NFHD78
It may not help in your situation, but did you know that you can also index the row with the Column instances themselves Ie: row[table.c.column] Simon > -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Yuri Pimenov > Sent: 27 November 2007

[sqlalchemy] Re: access mapped object attributes

2007-11-06 Thread King Simon-NFHD78
You may be interested in an older thread, 'How to get list of relations': http://groups.google.com/group/sqlalchemy/browse_thread/thread/ff03af921 eb12acb/861597e8a72f5e6f Simon -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Christophe Alexa

[sqlalchemy] Re: Please add some __len__ methods

2007-10-22 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of klaus > Sent: 22 October 2007 11:33 > To: sqlalchemy > Subject: [sqlalchemy] Please add some __len__ methods > > > Hi all, > I wonder why some classes/objects implement part of a list inte

[sqlalchemy] Re: one-to-many access and modification

2007-10-02 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of Ken Pierce > Sent: 29 September 2007 00:21 > To: sqlalchemy > Subject: [sqlalchemy] one-to-many access and modification > > > Hello all, > > I just got into using sqlalchemy today and I ha

[sqlalchemy] LIMIT syntax in old versions of MySQL

2007-09-20 Thread King Simon-NFHD78
Hi, The ancient version of MySQL that I am connecting to (3.23.58) doesn't support the syntax 'LIMIT OFFSET ' syntax. Instead, it uses LIMIT , . This is described in the docs, but it doesn't say what version introduced the more standard syntax: http://dev.mysql.com/doc/refman/5.0/en/select.html

[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-20 Thread King Simon-NFHD78
Noufal wrote: > > > I create two tables like so > run_table = sa.Table('runs',md, > sa.Column('rid', sa.Integer, > primary_key=True), > sa.Column('cmdline', sa.String(250)), > sa.Column('hostname', s

[sqlalchemy] Re: Outerjoin with a subset of columns

2007-08-15 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of mc > Sent: 15 August 2007 14:23 > To: sqlalchemy > Subject: [sqlalchemy] Outerjoin with a subset of columns > > > Hi, > > Note the following code: > > oj=outerjoin(s,f) > r1=select([oj]).

[sqlalchemy] Re: Hierachical data

2007-08-03 Thread King Simon-NFHD78
Hi, I think this is a pretty good match for Joined Table polymorphic inheritance, as described in the docs . Your nodes_table would correspond to the employees table, and the 'subclass' tables such as video co

[sqlalchemy] Re: ConcurrentModificationError: Updated rowcount 0 does not match number of objects updated 1

2007-07-31 Thread King Simon-NFHD78
databases/mysql.py has this snippet in create_connect_args (0.3.10): # FOUND_ROWS must be set in CLIENT_FLAGS for to enable # supports_sane_rowcount. client_flag = opts.get('client_flag', 0) if self.dbapi is not None: try: import MySQLdb

[sqlalchemy] Re: not updated relation one-to-many

2007-07-27 Thread King Simon-NFHD78
The problem is that when you run your last query, SA sees that there is still an existing T1 object (with the right primary key) in memory (both in the session and in your 'a1' and 'ra1' variables). It deliberately doesn't update them. To get the behaviour you expect, you need to get rid of previ

[sqlalchemy] Re: lazy table creation

2007-07-27 Thread King Simon-NFHD78
You want something like this: user_table = Table('users', metadata, Column('userid', String(8))) user_table.create(checkfirst=True) # or # metadata.create_all(checkfirst=True) Documentation is at: http://www.sqlalchemy.org/docs/metadata.html#metadata_creating Hope that helps, Simon > -O

[sqlalchemy] Re: Model to Dictionary

2007-07-24 Thread King Simon-NFHD78
What do you mean by a model? If you are talking about an instance of a mapped class, you could try something like this (untested): def model_to_dict(instance): model_dict = {} for propname in instance.mapper.props: model_dict[propname] = getattr(instance, propname) return mode

[sqlalchemy] Re: Creating where clauses programatically

2007-07-06 Thread King Simon-NFHD78
SQLAlchemy Column objects override the '==' operator (and many others as well) so that python expressions get converted to appropriate SQL expressions. It's mentioned (briefly) here: http://www.sqlalchemy.org/docs/sqlconstruction.html#sql_whereclause Hope that helps, Simon > -Original

[sqlalchemy] Re: advanced mapping help

2007-06-25 Thread King Simon-NFHD78
Can't you define the ContentCollection mapper without any reference to Content, and then when you define the Content mapper, you can set up two relations to ContentCollection with appropriate backrefs? If that doesn't work, you can add properties to a mapper after it has been defined, so you can

<    1   2   3   >