[Sqlalchemy-users] count() for selectables broken?

2006-03-07 Thread daishi
Hi, I haven't had a chance to dig through why this is coming up, but it seems like count() for selectables is getting rebound from what FromClause defines. Test code and output are below. --- test code: # Test count() on selectable import sqlalchemy as rdb engine = rdb.create_engine('sqlite:/

Re: [Sqlalchemy-users] specifying the primary key for an arbitrary selectable

2006-02-02 Thread daishi
On Feb 2, 2006, at 3:04 PM, Michael Bayer wrote: the mapper() object allows you to specify a primary_key on the mapper, as it relates to its selectable: s = mytable.select(table.c.col1==5) m = mapper(s, primary_key=[s.c.id]) so you can stick a straight table or an aliased sele

Re: [Sqlalchemy-users] specifying the primary key for an arbitrary selectable

2006-02-02 Thread daishi
On Feb 2, 2006, at 2:13 PM, Michael Bayer wrote: you want to set primary keys on a selectable ? selectables are supposed to very closely relate to SQL constructs. the mapper level is where you can define your not-quite-SQL constructs and how they map to your SQL constructs. since a SELECT st

[Sqlalchemy-users] specifying the primary key for an arbitrary selectable

2006-02-02 Thread daishi
hi, i'm trying to use an aliased selectable with a mapper, and the i'm getting an error that the selectable does not have a primary key. the error also says that i can specify the primary key to the mapper init, but i'd rather tell the selectable what its primary key is instead. i see that ther

[Sqlalchemy-users] small fix for sql.py for the IS NULL case

2006-02-01 Thread daishi
pretty sure the following was what was intended: Index: sql.py === --- sql.py (revision 879) +++ sql.py (working copy) @@ -465,7 +465,7 @@ if obj is None: if operator != '=':

Re: [Sqlalchemy-users] self-ref .commit() problem

2006-01-30 Thread daishi
On Jan 28, 2006, at 2:52 PM, Michael Bayer wrote: What this is doing is taking the usual dependency sort at the table level, detecting if there are cycles, and if so breaking it down to a dependency sort at the object instance level. So you still need to ultimately not have a circular relation

Re: [Sqlalchemy-users] clearing (parts of) identity_map

2006-01-26 Thread daishi
On Jan 26, 2006, at 8:47 AM, Michael Bayer wrote: I like that patch, but just curious, how does this save memory ? If the object still exists in the identity map, which is a WeakValueDictionary, that implies that a reference is still hanging around on that object somewhere else. Removing fro

[Sqlalchemy-users] clearing (parts of) identity_map

2006-01-25 Thread daishi
hi, i'm having some issues with memory even with the weakref stuff. i have a feeling there must be better solutions, but for now i've given myself a manual way of clearing out the identity_map. i think i have the checks to make sure that it's okay to clear the id correct, but i'm not so sure. in

Re: [Sqlalchemy-users] "rebinding" a mapper property

2006-01-24 Thread daishi
On Jan 24, 2006, at 4:29 PM, Michael Bayer wrote: but show me what youre trying to do again, a little more simply, so i can see what youre looking for. hi mike, thanks as always for your response. i unfortunately haven't had a chance to isolate some of the issues that i'm currently having into

Re: [Sqlalchemy-users] "rebinding" a mapper property

2006-01-24 Thread daishi
On Jan 24, 2006, at 1:51 PM, Michael Bayer wrote: you should be able to do this: del objectstore.uow().identity_map[objectstore.instance_key(obj)] hi mike, i couldn't seem to get this to work. afaict the identity_map is empty with the test code that i have - i looked around just in case in uo

Re: [Sqlalchemy-users] "rebinding" a mapper property

2006-01-24 Thread daishi
On Jan 23, 2006, at 8:56 PM, Michael Bayer wrote: do this: m = mapper(cls, table, is_primary=True) thanks mike. is there a better way to do what i'm doing in the REGET section? --- if REGET: del x1 x1 = m1.selectone() --- ideally i'd like something like: m1.clear_cache(x1) o

[Sqlalchemy-users] "rebinding" a mapper property

2006-01-23 Thread daishi
hi, i'm trying to do something which is perhaps fundamentally ill-advised, but it would be great if something like this could work. the code is below, but it probably could use some explanation. i start with 2 tables 't1' and 't2a', where 't2a' FKs into 't1'. naturally, i create a relation betw

Re: [Sqlalchemy-users] small patch for selectone()

2006-01-23 Thread daishi
On Jan 23, 2006, at 5:41 PM, Michael Bayer wrote: hmm does it really ? I am most accustomed to Oracle where getting just the first row back of a huge result set is not much different than just getting one (and also, Oracle doesnt even have 'limit', and I have instead hacked together some "rowi

Re: [Sqlalchemy-users] ID sequences

2006-01-23 Thread daishi
On Jan 23, 2006, at 2:50 PM, [EMAIL PROTECTED] wrote: also curious why you have a separate step for generating primary keys, since that behavior is built-in via sequences or "defaults". hmm; i was having some issues with that before, but you're right, it seems to work without. i'm not sure wh

[Sqlalchemy-users] small patch for selectone()

2006-01-23 Thread daishi
the following minor patch makes selectone() much faster for large result sets: --- Index: mapping/mapper.py === --- mapping/mapper.py (revision 839) +++ mapping/mapper.py (working copy) @@ -416,6 +416,7 @@ def selectone(self

Re: [Sqlalchemy-users] self-ref .commit() problem

2006-01-23 Thread daishi
On Jan 23, 2006, at 1:55 PM, Michael Bayer wrote: So they are adding some overhead to the commit, but not a lot. They are definitely not being manifest as any additional SQL or anything like that. hi mike, thanks as always for the response. i do understand (and see) that the actual sql sent t

Re: [Sqlalchemy-users] self-ref .commit() problem

2006-01-23 Thread daishi
On Jan 20, 2006, at 9:51 PM, Michael Bayer wrote: update and try it again. the fix i made for you yesterday was slightly incorrect. youll notice that the dependency graph produced for the second commit is much smaller after you update this change. hi mike, thanks for the update - things se

Re: [Sqlalchemy-users] self-ref .commit() problem

2006-01-20 Thread daishi
On Jan 20, 2006, at 5:36 PM, Michael Bayer wrote: Also, if you want to gain some understanding of objectstore, which would be helpful if you have any ideas to offer, i just committed a nicer "dependency dump" function. If you turn on sqlalchemy.mapping.objectstore.LOG = True , youll see a "tas

Re: [Sqlalchemy-users] more backref q's

2006-01-20 Thread daishi
s patch as a reasonable starting point? thanks, daishi --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as s

Re: [Sqlalchemy-users] self-ref .commit() problem

2006-01-20 Thread daishi
nse, since the cycle won't get caught by the 't[0] is t[1]' check. nevertheless, i also wonder if this is something that you expect to support in the future? sorry to be bringing up less common use-cases, but sqlalchemy gives me the hope of leveraging these features through python. th

Re: [Sqlalchemy-users] easy create user-defined class

2006-01-20 Thread daishi
On Jan 20, 2006, at 6:12 AM, Jonathan Ellis wrote: Incidently, the PEP has been updated following a python-dev thread in which Ian Bicking noted that "I personally prefer cls, there are some who use klass, and I haven't see class_ used." The PEP now recommends the use of cls. fwiw, as i unders

[Sqlalchemy-users] self-ref .commit() problem

2006-01-19 Thread daishi
hi again, i'm having some problems doing a .commit(). the test code is a very minor tweak on the one from the previous backref thread, and is included below. the exception that i get is 'KeyError' - i poked around via pdb, and see that there are some odd things with the UOW dependencies, but i g

Re: [Sqlalchemy-users] more backref q's

2006-01-19 Thread daishi
On Jan 19, 2006, at 2:37 PM, [EMAIL PROTECTED] wrote: illustrated in the sample code before, by s/before/below/ --- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX sea

[Sqlalchemy-users] more backref q's

2006-01-19 Thread daishi
hi, i'm trying to muddle my way through properties.py in an attempt to understand what backref does, but i'm getting a bit confused. ultimately i'm just trying to clarify in my mind what the differences are between using backref and defining two separate properties. this is illustrated in the sa

Re: [Sqlalchemy-users] Information Schema

2006-01-17 Thread daishi
hi mike, thanks as always for your thoughtful response. (i hadn't expected a discussion on the little side-comments in my example!) On Jan 15, 2006, at 8:37 PM, Michael Bayer wrote: ok...would we want to have all the information_schema tables available in the ischema module ? if so, would we w

[Sqlalchemy-users] small patch for database/postgres.py

2006-01-13 Thread daishi
i believe the following is a fix for a small buglet. (i encountered a problem creating a table w/ foreign keys in a non-default schema) d Index: databases/postgres.py === --- databases/postgres.py (revision 817) +++ databases/

Re: [Sqlalchemy-users] Information Schema

2006-01-13 Thread daishi
On Jan 11, 2006, at 5:41 PM, [EMAIL PROTECTED] wrote: i think at least using information_schema as a baseline is probably useful; let me go ahead and do what i was talking about so you can at least have some code to look at when thinking about how to generalize to be cross-db. i'm attaching bot

Re: [Sqlalchemy-users] Information Schema

2006-01-11 Thread daishi
On Jan 10, 2006, at 7:49 PM, Michael Bayer wrote: well I already have a few of the information_schema tables in a package called sqlalchemy.databases.information_schema, and youre free to embellish that package. that's pretty much what i've been doing so far ... it might be more useful, c

Re: [Sqlalchemy-users] help() under python interp

2006-01-11 Thread daishi
On Jan 11, 2006, at 10:59 AM, David Geller wrote: Trying to use help() under python interperter, and get error: >>> import sqlalchemy >>> help(sqlalchemy) . OSError: [Errno 20] Not a directory: '/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.91alpha- py2.4.egg/sqlalchemy' i believe

Re: [Sqlalchemy-users] Information Schema

2006-01-10 Thread daishi
On Jan 10, 2006, at 6:38 PM, Michael Bayer wrote: well if you are referring to the "information schema" that postgres uses, only postgres has that specific schema represented within it (and its also quite complicated). Mysql seems to support a slightly different version of it and also one that

Re: [Sqlalchemy-users] Information Schema

2006-01-10 Thread daishi
i just wanted to clarify since i realized that the 'columns' in my example was rather ambiguous. On Jan 10, 2006, at 5:19 PM, [EMAIL PROTECTED] wrote: engine = create_engine('...') c = engine.ischema.columns c.select(c.c.table_name=='foo') what i mean here is that 'c' is the *Table* informatio

[Sqlalchemy-users] Information Schema

2006-01-10 Thread daishi
Hi, I would like to make the information schema more directly accessible. It appears that currently this is only used for the 'reflecttable' method to introspect table definitions. Based on my current understanding of sqlalchemy I think it would be reasonable for SQLEngine instances to have an '

[Sqlalchemy-users] backreference vs. backref

2006-01-05 Thread daishi
hi again, the docs indicate 'backreference' as the kwarg to use to activate the feature as described in "Useful Feature: Backreferences", but it looks like the code expects 'backref'? not sure if a doc fix or a code fix would be preferred here. thx, d

[Sqlalchemy-users] self-joins, namespace schemas

2006-01-04 Thread daishi
, so I couldn't move forward with debugging. I am also using namespace schemas, and believe that there is a problem with ForeignKey objects not handling namespace schemas. I am attaching a patch for that. (I have simplified the attached test.py to not use namespace schemas). Thanks, Dais