[sqlalchemy] Re: Lazy loading advantages and disadvantages

2007-02-23 Thread Adam M Peacock
Thank you, that is exactly what I was looking for. On Feb 22, 2007, at 5:58 AM, King Simon-NFHD78 wrote: > > Adam M Peacock wrote: >> Is there a difference in the SQL executed when using lazy vs eager >> loading? Specifically, if I use eager loading will everything be >> queried at once with a

[sqlalchemy] Query.get(), minor request

2007-02-23 Thread Luke Stebbing
This is really just a minor detail, but I noticed that Query.get(None) will fail with an exception instead of returning None. It has the mapper call "identity_key_from_primary_key", and that tries to do "tuple(util.to_list(None))" -> "tuple(None)" -> TypeError. --~--~-~--~~--

[sqlalchemy] Re: Asynchronous SQLAlchemy--Anybody using Twisted, sAsync?

2007-02-23 Thread Allen Bierbaum
On 2/21/07, Manlio Perillo <[EMAIL PROTECTED]> wrote: > > Matt Culbreth ha scritto: > > Howdy Group, > > > > I'm playing out with a few things now and I wanted to see if anyone > > else has used SQLAlchemy in an asynchronous manner? For example, you > > could create a service which responded to a

[sqlalchemy] Re: suggestion to use deferrable foreign key constraints

2007-02-23 Thread Luke Stebbing
PG and Oracle allow you to defer foreign key constraints (Oracle apparently lets you defer *all* constraints, mmm), and MySQL and SQLite (of course) don't. I'm not sure about other databases. The SQL keyword in question is DEFERRABLE. References: http://www.postgresql.org/docs/8.2/interactive/sq

[sqlalchemy] how to force a clean refresh of a lazy loaded attribute

2007-02-23 Thread Manlio Perillo
Hi again. I have an object attribute loaded via lazy loader. This object is loaded in a transaction. Then, in another transaction, I ussue an update statement (via the sql module, not using the orm), that updates the table of the main object's attribute. The problem, now, is that I want to re

[sqlalchemy] Re: problems with exists

2007-02-23 Thread Michael Bayer
yah a little bug there, exists() was degined to be used in WHERE criterion but not as a standalone. theres a tweak in r2358 where it will suppress its "FROM" list in a select the way you were trying to do. On Feb 23, 10:25 am, Manlio Perillo <[EMAIL PROTECTED]> wrote: > Hi. > > I'm having prob

[sqlalchemy] Spatial data (PostGIS/OGC) with SqlAlchemy

2007-02-23 Thread Allen
I would like to use SqlAlchemy with PostGIS to create, read, update, and query spatial data. I have search around a bit and found a few ideas of doing this [1][2] but I haven't seen a definitive best practice by any means. It looks like all the solutions I can find have a least some limitations.

[sqlalchemy] Re: non-autoincrementing, but DB-assigned primary keys

2007-02-23 Thread Sean Davis
On Friday 23 February 2007 10:52, Michael Bayer wrote: > PassiveDefault is used for this. Thanks. Works perfectly. > On Feb 23, 2007, at 6:35 AM, Sean Davis wrote: > > If I have a table that generates primary keys like this (in postgres): > > > > create table ...( > > pk varchar default ('pk-

[sqlalchemy] Re: non-autoincrementing, but DB-assigned primary keys

2007-02-23 Thread Michael Bayer
PassiveDefault is used for this. On Feb 23, 2007, at 6:35 AM, Sean Davis wrote: > If I have a table that generates primary keys like this (in postgres): > > create table ...( > pk varchar default ('pk-'||nextval('table_seq'::regclass)::varchar), > ..., > primary key(pk) > ); > > on the dat

[sqlalchemy] select ... having problems

2007-02-23 Thread Arthur Clune
This should be easy, but I'm having real problems with it. I'd like to do the following SQL (this is from MySQL) as a sqa query: select count(distinct flow.node_id) as nodes, ip.ip_addr, ip.country, ip.domain, ip.isp, ip.city from flow, ip where flow.src_id = ip.id group by flow.src_id having

[sqlalchemy] problems with exists

2007-02-23 Thread Manlio Perillo
Hi. I'm having problems with the exists clause. Here is the code: from sqlalchemy import * db = create_engine('sqlite:///', echo=True) metadata = BoundMetaData(db) test = Table( 'test', metadata, Column('id', Integer, primary_key=True), Column('x', String), Column('y', St

[sqlalchemy] non-autoincrementing, but DB-assigned primary keys

2007-02-23 Thread Sean Davis
If I have a table that generates primary keys like this (in postgres): create table ...( pk varchar default ('pk-'||nextval('table_seq'::regclass)::varchar), ..., primary key(pk) ); on the database side, how can I pass that information on to sqlalchemy? I am trying to autoload the tables (