[sqlalchemy] Re: minimizing number of connections created

2007-08-22 Thread Michael Bayer
use autoload_with= when you create the Table. Dont use BoundMetaData. On Aug 22, 2007, at 5:53 PM, mc wrote: > > Hi, > the following code creates 2 connections. > Is there way to make it 1, either by making the Table share > connection1 or > by releasing the connection Table used after it loa

[sqlalchemy] Re: SA 0.4, pylons 0.9.6rc3

2007-08-22 Thread jason kirtland
Anil wrote: > Actually, there was some information in the logs that I just noticed > that might help detect the problem (some kind of unicode issue?): > > 12:58:21,710 INFO [sqlalchemy.engine.base.Engine.0x..50] SHOW CREATE > TABLE `User` > 12:58:21,711 INFO [sqlalchemy.engine.base.Engine.0x..5

[sqlalchemy] minimizing number of connections created

2007-08-22 Thread mc
Hi, the following code creates 2 connections. Is there way to make it 1, either by making the Table share connection1 or by releasing the connection Table used after it loaded the metadada? TIA connect_s = 'mysql://%s:[EMAIL PROTECTED]/%s' % (user, pw, server, db) engine = sqlalch

[sqlalchemy] SQLAlchemy 0.4 beta4 released

2007-08-22 Thread Michael Bayer
I've just put beta4 out, which fixes some important issues and also has lots more performance enhancements. In particular, the connection pool works a little differently now, so please let us know if any stability issues arise. One caveat with this release is that I just noticed that the S

[sqlalchemy] Re: How can I do join on a self-referential m2m relation?

2007-08-22 Thread Michael Bayer
Hi Jian - yes, its the PropertyAliasedClauses. I put in a fix + a test based on your example in r3410. i didnt yet add a test for more levels deep yet, though, so see how that goes. - mike On Aug 22, 2007, at 3:07 PM, Jian Luo wrote: > class Widget(object): > pass > > mapper(Widget,

[sqlalchemy] Re: Self-referential property

2007-08-22 Thread Michael Bayer
On Aug 22, 2007, at 2:31 PM, Christoph Haas wrote: > The error disappeared. But getting the joined PTR records for a > certain > inet took very long. So I analyzed the query that SQLAlchemy did: > > SELECT records.id AS records_id, records.domain_id AS > records_domain_id, records.dhcp

[sqlalchemy] Re: SA 0.4, pylons 0.9.6rc3

2007-08-22 Thread Anil
| User | CREATE TABLE `User` ( `id` int(10) unsigned NOT NULL auto_increment, `location_id` int(10) unsigned NOT NULL, `mail` varchar(45) NOT NULL, `password` varchar(45) NOT NULL, `salt` varchar(8) NOT NULL, `phone` varchar(24) default NULL, `organization` varchar(45) default NULL,

[sqlalchemy] Re: SA 0.4, pylons 0.9.6rc3

2007-08-22 Thread jason kirtland
Hi Anil, The recent 0.4 betas have an all-new MySQL table reflection routine that's being tried out. It's possible that it's not picking up your primary key when it should- could you send in the output of SHOW CREATE TABLE for this table, either on or off list? Also there should be a warnin

[sqlalchemy] Re: echo-es

2007-08-22 Thread sdobrev
> will restore engine.echo today. what about Metadata's? why not leave some enginetype-indepedent kwargs there (or at least echo, its the most used in lets-try-this-now cases), which go together with the bind to the create()? i know i know explicit is better than implicit... noone would be forc

[sqlalchemy] Re: How can I do join on a self-referential m2m relation?

2007-08-22 Thread Jian Luo
Hallo Mike, first of all, thank you for your great great sqlalchemy! On Aug 22, 6:49 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > im not sure about how elixir does bi-directional relationships but it > seems strange that you have set up the "children" and "parents" > relationships twice in b

[sqlalchemy] Re: Self-referential property

2007-08-22 Thread Christoph Haas
On Wed, Aug 22, 2007 at 12:37:32PM -0400, Michael Bayer wrote: > > > On Aug 22, 2007, at 8:27 AM, Christoph Haas wrote: > > > > > But that example deals with User and Address tables and not with > > self-references. I suspect I have to alias the table. Roughly I'm > > thinking of something like

[sqlalchemy] Re: echo-es

2007-08-22 Thread Michael Bayer
will restore engine.echo today. leaving it out on session and pool, however (bet you didnt know they had "echo" too...) On Aug 22, 2007, at 5:11 AM, svilen wrote: > > in 0.3, one could do > meta = MetaData( whatever, echo=True) > later, early 0.4, the echo kwarg was gone, so it got less con

[sqlalchemy] Re: How can I do join on a self-referential m2m relation?

2007-08-22 Thread Michael Bayer
On Aug 22, 2007, at 11:37 AM, Jian Luo wrote: > > Hi List, > > I have a table defined in elixir, simplified as following: > class Widget(Entity): > """Form, Fieldset or Field > """ > has_field('name', Unicode(40), nullable=False, unique=True) > has_and_belongs_to_many('children',

[sqlalchemy] Re: Self-referential property

2007-08-22 Thread Michael Bayer
On Aug 22, 2007, at 8:27 AM, Christoph Haas wrote: > > But that example deals with User and Address tables and not with > self-references. I suspect I have to alias the table. Roughly I'm > thinking of something like: > > properties={ > 'ptr_records': relation(Record, primaryjoin=and

[sqlalchemy] Re: large amount of insert

2007-08-22 Thread Glauco
Michael Bayer ha scritto: > well at the very least you want to ensure that executemany() is being > used for the inserts (i.e. with sqlalchemy, dont use ORM, use > connection.execute(statement, [param, param, param...]). > > If you use SQLAlchemy's "executemany()" facilities, we've just > increase

[sqlalchemy] How can I do join on a self-referential m2m relation?

2007-08-22 Thread Jian Luo
Hi List, I have a table defined in elixir, simplified as following: class Widget(Entity): """Form, Fieldset or Field """ has_field('name', Unicode(40), nullable=False, unique=True) has_and_belongs_to_many('children', of_kind='Widget', inverse='parents') has_and_belongs_to_many

[sqlalchemy] Re: echo-es

2007-08-22 Thread svilen
> Another thing, the dots that are produced by unittests magically > disappear if meta.bind.echo = True, very interesting.. shoot me, thats my problem --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" grou

[sqlalchemy] Self-referential property

2007-08-22 Thread Christoph Haas
Dear list, I'm still working on a DNS administration web interface and have to deal with DNS records. This is what I have so far: --- import sqlalchemy as sql import sqlalchemy.orm as orm from sqlalchemy.databases.postgr

[sqlalchemy] echo-es

2007-08-22 Thread svilen
in 0.3, one could do meta = MetaData( whatever, echo=True) later, early 0.4, the echo kwarg was gone, so it got less convenient, adding another line: meta.bind.echo = True As of latest trunk, neither works, one has to explicitly do meta = MetaData( create_engine(whatever, echo=True)) which is

[sqlalchemy] Re: adjacency list: filtering relations eagerly

2007-08-22 Thread stephen emslie
> my_eager_alias = mynodes.alias('mynodes') > query = query.filter(...wahtever criterion you're using...) > query = query.from_statement(select([mynodes, my_eager_alias], > query._criterion)).\ >.options(contains_eager('children', alias=my_eager_alias)) >.options(eagerload('childre