[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, King Simon-NFHD78 simon.k...@motorola.com wrote

[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 sometimes I have

[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 with my

[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 setting

[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 converting

[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 items of a

[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 solve (SA

[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 successive runs, and

[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: 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 in

[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.. The first

[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 early

[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] 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: 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 issue SQL

[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 are some other scenarios where this kind of thing occurs (lazy clause

[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 agree that

[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 problem

[sqlalchemy] Re: Dynamic making of the where clause

2009-06-26 Thread King Simon-NFHD78
On Jun 23, 3:32 pm, Ash ashishsinghbha...@gmail.com 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

[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 =

[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] but

[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,

[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 answered my

[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 arbitrary

[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 alias on

[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 =

[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 querying: the

[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 things: 1) I

[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 =

[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 update the

[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 individual

[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 trying to make

[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:

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

2009-01-30 Thread King Simon-NFHD78
, 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 that we know when polymorphic_identity is defined or not. it's

[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 to serialize

[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've got a

[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 SQL Alchemy

[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 Bayer

[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:

[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'm trying to

[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 ExtraStat

[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

[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 , you

[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 simply not

[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 [EMAIL

[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, 2008 at 4:33 AM, King Simon-NFHD78

[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 settings

[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) for each

[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 code, i

[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 Syring

[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? Seems

[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.clause and

[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') count =

[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

[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 records in

[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 +

[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 match the spec

[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 advisable implement

[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 08 February

[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

[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

[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),

[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

[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 table ON condition syntax Ie. this gives a syntax error: SELECT * FROM productversions pv JOIN producttypes pt ON pv.producttype = pt.producttype Whereas this is fine:

[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. (...) File

[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 SQL INSERT statement, but hasn't been read back from

[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 table ON condition syntax Ie. this gives a syntax error: SELECT * FROM

[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 table ON condition syntax Ie. this gives a syntax error: SELECT * FROM productversions pv JOIN

[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] 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] 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.4.1, trying to do this results

[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 data into

[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: #record is

[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

[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 interface -

[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 have a

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

2007-09-20 Thread King Simon-NFHD78
Noufal wrote: snip 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',

[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 limit OFFSET offset' syntax. Instead, it uses LIMIT offset, limit. This is described in the docs, but it doesn't say what version introduced the more standard syntax:

[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)

[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 http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_inhe ritance_joined. Your nodes_table would correspond to the employees table, and the 'subclass' tables such as video

[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

[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

[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

[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: UniqueObject recipe and turbogears

2007-06-19 Thread King Simon-NFHD78
The way to hook most parts of the ORM is by creating a MapperExtension http://www.sqlalchemy.org/docs/adv_datamapping.html#advdatamapping_exte nding. Basically, define a subclass of MapperExtension, overriding whichever method you are interested in (possibly append_result or create_instance in

[sqlalchemy] Autoloading tables on old versions of MySQL

2007-06-14 Thread King Simon-NFHD78
Hi, I just noticed that autoloading of tables on old versions of MySQL is broken (I'm using 3.23.58, but I believe the problem will occur up to 4.1.1) The problem is that reflecttable tries to use the 'character_set_results' system variable, which was only introduced in 4.1.1. The attached patch

[sqlalchemy] Re: how to retrieve/update data from/on multiple databases

2007-05-30 Thread King Simon-NFHD78
I think the answer to this partly depends on which parts of SA you are using, and how your databases are set up. If all the databases have different schemas, and you are using the low-level SA API (or your ORM objects are each defined against a single database), I would probably use a

[sqlalchemy] Re: auto-load ForeignKey references?

2007-05-10 Thread King Simon-NFHD78
Max Ischenko wrote: On May 10, 4:38 pm, King Simon-NFHD78 [EMAIL PROTECTED] wrote: You're halfway there with your 'posts' relation. I think if you pass backref='author' in your relation, then WordpressPost objects will get an 'author' property which points back to the WordpressUser

[sqlalchemy] Re: elixir, sqlalchemy myqldb: Error connectiong to local socket

2007-05-09 Thread King Simon-NFHD78
Pirkka wrote: I started migrating from ActiveMapper to Elixir, and have been wrestling with this for hours: DBAPIError: (Connection failed) (OperationalError) (2005, Unknown MySQL server host '/Applications/MAMP/tmp/mysql/mysql.sock' (1)) Here are the command parameters that sqlalchemy

[sqlalchemy] Re: 'MapperExtension' object has no attribute 'translate_row'

2007-05-04 Thread King Simon-NFHD78
Hi, Your TaskExtension class doesn't have a translate_row method, which apparently is part of the MapperExtension interface (although it doesn't appear in the docs). From the source code (in orm/mapper.py): def translate_row(self, mapper, context, row): Perform pre-processing on the

[sqlalchemy] Re: SELECT LIKE

2007-04-13 Thread King Simon-NFHD78
Disrupt07 wrote: I have a table storing users' info. table: userinfo columns: name, surname, age, location, ... I need to query this table using SQLAlchemy's ORM methods (e.g. select(), select_by(), get_by()). The query should be like SELECT * FROM userinfo WHERE name LIKE 'Ben%'

[sqlalchemy] Re: SELECT LIKE

2007-04-13 Thread King Simon-NFHD78
Disrupt07 wrote @Simon Thanks. But what is your_query? Is it SQLAlchemy or pure SQL? It is a Query object, as described here: http://www.sqlalchemy.org/docs/datamapping.html If you haven't read them yet, I'd recommend working through a tutorial - I found this one really helpful:

[sqlalchemy] Re: sqlalchemy.orm.attributes.InstrumentedList

2007-04-12 Thread King Simon-NFHD78
Disrupt07 wrote What is sqlalchemy.orm.attributes.InstrumentedList? I need to use the sqlalchemy.orm.attributes.InstrumentedList type in my Python controller methods and need to check if the type of another object is of type sqlalchemy.orm.attributes.InstrumentedList. How can I do

[sqlalchemy] Re: 'PropertyLoader' object has no attribute 'strategy'

2007-04-11 Thread King Simon-NFHD78
Roger Demetrescu wrote: On 4/11/07, King Simon-NFHD78 [EMAIL PROTECTED] wrote: I've got no idea about the source of the problem, but it would probably be helpful if you could provide stack traces from the exceptions, if that's possible. Do you mean using the traceback module

[sqlalchemy] Re: offset limit on query with relations

2007-04-05 Thread King Simon-NFHD78
Huy wrote: Hi, When using the generative limit() offset() or order_by calls on mapper query, the sql generated looks weird. I get something like select table1.* table2.* from (select table1a.id from table1a limit 20 offset 0 order by table1.col) as table_row, table1 join

[sqlalchemy] Re: Confused by foreign_keys argument

2007-03-28 Thread King Simon-NFHD78
to model. On Mar 28, 2007, at 10:39 AM, King Simon-NFHD78 wrote: a_table = Table('a', metadata, Column('id', Integer, primary_key=True), Column('name', String(16)), ) b_table = Table

[sqlalchemy] Re: Using mapper with custom select creates unneeded subquery

2007-03-22 Thread King Simon-NFHD78
This caught me out a couple of weeks ago, and I've seen a couple of other similar questions as well. You need to add 'correlate=False' to the nested select. I wonder if this should be added to the FAQ? Hope that helps, Simon -Original Message- From: sqlalchemy@googlegroups.com

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread King Simon-NFHD78
Michael Bayer wrote: On Mar 17, 2007, at 11:39 AM, Simon King wrote: I had assumed that post_update was only necessary when you are inserting two rows that are mutually dependent, but in this case I wasn't inserting either a ReleaseLine or a Label. I suppose post_update can

<    1   2   3   >