Re[6]: [Sqlalchemy-users] CASE in column list

2006-05-17 Thread Gambit
r'. I > tested with databases other than Sqlite, and the 'inner' name causes > problems. > Copying Mike as well > Rick > On 5/14/06, Gambit <[EMAIL PROTECTED]> wrote: >> >> Hey Rick, >> >> Basically the issue as I see it is t

Re[2]: [Sqlalchemy-users] More DateTime woes

2006-05-16 Thread Gambit
Hey Rick, Unicode stuff doesn't work well in psycopg1 either. I'm all for not supporting it anymore, as making the mistake of starting off in it cost me a few days tracking down strange problems. It's documented in the wiki and in the mailing list, but I agree there's no good reason (besides ver

Re[4]: [Sqlalchemy-users] CASE in column list

2006-05-14 Thread Gambit
code this seems like the right direction to go, if you're willing :) If you're busy, let me know and I'll see about cornering mike into giving me his opinion :) Cheers! -G On Sunday, May 14, 2006, 4:50:41 AM, you wrote: > Hey Gambit, > Yeah, we'll need a way to alias the co

Re[2]: [Sqlalchemy-users] CASE in column list

2006-05-13 Thread Gambit
Hey Rick, I was playing with this patch a bit and noticed that while it seems pretty good for select()'s, it falls apart in sub-selects. It doesn't propagate as a column, thus doesn't get an alias for the outer select to work off of, and it all falls apart :) Hopefully there's an easy way to sol

Re: [Sqlalchemy-users] default timestamp + postgres

2006-05-11 Thread Gambit
Hey Jonathan, Try this: Column('data', String(250), default=func.current_timestamp() + '12 hours') Also, see attached sample for postgresql. -G On Thursday, May 11, 2006, 11:09:41 PM, you wrote: > I'm trying to get SQLalchemy to set this as the insert value: > Column( "timestamp_expire

Re: [Sqlalchemy-users] primary_key parameter on mapper

2006-05-11 Thread Gambit
Hey Sandro, IIRC, the primary_key parameter tells the mapping engine which specific columns compose the primary key for that map. This is used in the identity map to identify already-fetched objects, create relations, and so forth while ensuring there aren't any duplicates involved (i.e. two sepa

Re[2]: [Sqlalchemy-users] eager load: is this correct?

2006-05-09 Thread Gambit
the need to then track in each object all the various conditions it was found under) of the User objects you find. If you want a straight list, then maybe stick with straight SQL? HTH, cheers! :) -G On Wednesday, May 10, 2006, 1:01:26 AM, you wrote: > On Wed, May 10, 2006 at 12:32:53AM +

Re: [Sqlalchemy-users] eager load: is this correct?

2006-05-09 Thread Gambit
Hey Sandro, My understanding is, the from_obj isn't necessary here. Regardless, though, it works fine with it (or without it) as the resulting query isn't substantially changed. Adding the missing comma from the sample code and fixing the print statement so that it iterates through the 'R.mail'

Re: [Sqlalchemy-users] How to extend a mapped class?

2006-05-09 Thread Gambit
Hey Marty, I don't claim to fully understand what your problem is, but... I think you're on the right track for putting the properties in the __init__ method for your class. I'm not sure why you're worried about the overhead, though, since it seems to be something like: if currentUser.perms =

Re: [Sqlalchemy-users] Database Migration

2006-05-09 Thread Gambit
Hey Florian, Wow, it seems this topic comes up every *checks mailing list-has it really been that short?* few weeks. For reference, see the thread: http://www.mail-archive.com/sqlalchemy-users@lists.sourceforge.net/msg00783.html And also the prospective SoC project here: http://www.m

Re[2]: [Sqlalchemy-users] unicode parameters

2006-05-09 Thread Gambit
Hey All, This really looks exactly like the unicode problems I was having. http://www.sqlalchemy.org/trac/ticket/86 Are you using psycopg1 or psycopg2? Tried convert_unicode? Test case passes using psycopg2 in 1419. -G On Tuesday, May 9, 2006, 2:05:19 AM, you wrote: > Dennis, > FWIW, Your

Re[2]: [Sqlalchemy-users] reverse engineer?

2006-05-08 Thread Gambit
Hey Jonathan, and everyone else, On the subject of large-table databases and representing them in an ORM environment, could I interest you in expanding on the following issues? These issues are more at the 'design' level then the typical 'it doesn't work' issues we deal with here, but with a coll

Re: Fwd: Re[2]: [Sqlalchemy-users] SQLAlchemy and py2exe Instructions

2006-05-08 Thread Gambit
list) > -- Forwarded message -- > From: Rick Morrison <[EMAIL PROTECTED]> > Date: May 8, 2006 2:08 PM > Subject: Re: Re[2]: [Sqlalchemy-users] SQLAlchemy and py2exe Instructions > To: Gambit <[EMAIL PROTECTED]> > Hey Gambit, > I'm using cx

Re[2]: [Sqlalchemy-users] mapper and join - again

2006-05-08 Thread Gambit
Hey Sandro, Just to make sure, but you're not looking for something like this, are you? Specifically the mapping against an arbitrary select bit towards the end? http://www.sqlalchemy.org/trac/wiki/UsageRecipes/OuterLeftJoin Cheers, -G On Monday, May 8, 2006, 7:27:01 PM, you wrote: > On Mon, Ma

Re[2]: [Sqlalchemy-users] SQLAlchemy and py2exe Instructions

2006-05-08 Thread Gambit
modules will be installed. This won't bite until you try to deploy. > Rick > On 5/7/06, Gambit <[EMAIL PROTECTED]> wrote: >> >> Hey All, >> >> Spent a little time today trying to package up my application for it's >> first >> round of t

[Sqlalchemy-users] SQLAlchemy and py2exe Instructions

2006-05-07 Thread Gambit
Hey All, Spent a little time today trying to package up my application for it's first round of test users and such. Put it together with the py2exe (and, eventually, will probably use 'freeze' for the linux side) and immediately ran into the problem of py2exe not understanding .egg's. Sigh. The

Re[4]: [Sqlalchemy-users] reverse engineer?

2006-05-07 Thread Gambit
fruition... HTH, -G On Sunday, May 7, 2006, 9:51:49 PM, you wrote: > On May 7, 2006, at 6:28 AM, Gambit wrote: >> Hey All, >> >> Maybe I'm missing something, but isn't this what reflection is all >> about? You >> can easily (well, on most DB's at

Re[2]: [Sqlalchemy-users] reverse engineer?

2006-05-07 Thread Gambit
Hey All, Maybe I'm missing something, but isn't this what reflection is all about? You can easily (well, on most DB's at least) throw a bit of explicit SQL at the database to get a list of all the tables, from there simply create the necessary Table() objects. It might take a while, of course, b

Re: [Sqlalchemy-users] Summer of Code proposal: schema migration tool

2006-05-06 Thread Gambit
Hey Evan, Funny, I'm a CSC Calpoly Grad myself :) Take any Staley classes recently? As you've looked through the mailing list, you've probably seen the time I brought this subject up as well. It's something I'm very much interested in! Swing by #myghty on irc.freenode.net if you're interested

Re: [Sqlalchemy-users] Reflection with Subselect Running Astray of convert_unicode=True

2006-05-03 Thread Gambit
This has been fixed and committed, according to Mike. -G On Wednesday, May 3, 2006, 1:58:40 PM, you wrote: > Hey All, > I'm running into an interesting problem. There's a quick obvious solution, > but I think it's a placebo, so I want to run this by everyone else first. > In this case (attached

[Sqlalchemy-users] Reflection with Subselect Running Astray of convert_unicode=True

2006-05-03 Thread Gambit
Hey All, I'm running into an interesting problem. There's a quick obvious solution, but I think it's a placebo, so I want to run this by everyone else first. In this case (attached .sql creates the necessary schema) I have three interconnected tables that I'm viewing using reflection. This is m

[Sqlalchemy-users] DISTINCT ON patch for PostgreSQL

2006-05-02 Thread Gambit
Hey All, Tossed together this patch for databases/postgres.py (see attached) to support pgsql's SELECT DISTINCT ON (col1, col2, col3...) col1, col2, ... functionality. Included are testcases for it. Supported syntax is: select([...],distinct=True) # Classic 'DISTINCT' behavior on

Re: [Sqlalchemy-users] select and boolean fields

2006-04-27 Thread Gambit
Hey Jonathan, What is the SQL that those lines create? I've used the == False syntax myself a few times. What does your actual SA query look like in code? The best debugging trick I can offer for SA is to always run with all the debugging output on. This lets you see what SA thinks you're aski

Re[4]: [Sqlalchemy-users] Incredibly simple question

2006-04-26 Thread Gambit
onship between the tables at all (i.e. a 'instance.instance_type_id == instance_type.id' clause). Good luck! -G On Wednesday, April 26, 2006, 9:13:25 PM, you wrote: > On Apr 26, 2006, at 6:09 AM, Gambit wrote: >> One way to write the query would be to use a proper Clause >>

Re[2]: [Sqlalchemy-users] Incredibly simple question

2006-04-26 Thread Gambit
Hey Jonathan, The reason this doesn't work is because you're supplying to a select query an instance object, when it's expecting either column types, actual values, or some other clause element. The actual error, I think, relates to 'type' being your LazyLoader property, and not an actual column!

Re[2]: [Sqlalchemy-users] Incredibly simple question

2006-04-25 Thread Gambit
#x27;FOO') > Or are there other ways? > A lot of stuff i do is part-python and part-perl -- so I often store > about 200 id/name values that are really configuration items into the > database itself > For stuff like this, i'm wondering if pre-caching these pairs is t

Re: [Sqlalchemy-users] Incredibly simple question

2006-04-25 Thread Gambit
Hey Jonathan, Welcome to ORMs :P I think your basic misunderstanding here is that with an ORM you're going to be mapping columns -- potentially brought together from different tables -- into a single cohesive unit that represents a logical grouping, rather then collapsing everything into a bucket

Re[4]: [Sqlalchemy-users] Many to Many Range Select has Poor Query Values

2006-04-25 Thread Gambit
not correct > elsewhere. are you using tables with autoload=True ? > On Apr 24, 2006, at 5:29 PM, Gambit wrote: >> Hey Mike, >> >> Interesting - in my demo environment it appears to work fine. >> However, in my >> production environment it actually

Re[3]: [Sqlalchemy-users] Many to Many Range Select has Poor Query Values

2006-04-24 Thread Gambit
WHERE cust_id = 19; > > cust_id | start_date | finish_date > -++- > 19 | 2006-02-01 | 2006-05-12 > (1 row) > Cheers! > -G > On Monday, April 24, 2006, 9:24:58 PM, you wrote: >> gambit - >>

Re[2]: [Sqlalchemy-users] Many to Many Range Select has Poor Query Values

2006-04-24 Thread Gambit
++- 19 | 2006-02-01 | 2006-05-12 (1 row) Cheers! -G On Monday, April 24, 2006, 9:24:58 PM, you wrote: > gambit - > the SQL clause it generates for the lazy criterion has the column > "timeval" in it twice, which resulted in a name

[Sqlalchemy-users] FYI: Keeping Egg's as Directorys and Not Zips

2006-04-24 Thread Gambit
Hey All - I'm sure most of you know this already, but in case anyones wondering why the pdb debugging wasn't working -- if you edit the 'setup.py' file pulled from subversion and add: "zip_safe = False," to the setup function call, it'll keep things nice and separated in directory form, which make

Re[2]: [Sqlalchemy-users] Many to Many Range Select has Poor Query Values

2006-04-24 Thread Gambit
Hey Mike, Brilliant as always! Care to hazard a guess as to what's with the sketchily required foreignkey field? -G On Monday, April 24, 2006, 9:24:58 PM, you wrote: > gambit - > the SQL clause it generates for the lazy criterion has the column > "timeval" in it tw

Re[4]: [Sqlalchemy-users] Syncrule Not Generated?

2006-04-23 Thread Gambit
gument?" or something equivilent? Maybe just having it note back to a specific place in the documentation for future suggestions, steps to repro and solve? -G On Sunday, April 23, 2006, 11:09:44 PM, you wrote: > hey gambit - > a cohesive error message begins as what it literally is b

Re[2]: [Sqlalchemy-users] Syncrule Not Generated?

2006-04-23 Thread Gambit
ject. > So when the relation system has that error with "no syncrules > generated", its a sign that the join conditions of the relationship > do not correspond to the tables represented by the mappers. > the code for this is pretty well isolated and docstring'ed

Re[4]: [Sqlalchemy-users] Many to Many Relationship with ;secondaryjoin' Failing

2006-04-23 Thread Gambit
.c.user_id, secondaryjoin=userkeywords.c.keyword_id==keywords.c.keyword_id ) }) right before the Lazy/Eager Joins Multiple Times to One Table section. -G On Sunday, April 23, 2006, 9:30:25 PM, you wrote: > gambit - > this doc ? > # define a mapper that does many-to-many o

[Sqlalchemy-users] Syncrule Not Generated?

2006-04-23 Thread Gambit
Hey All, For the line: Customer.mapper.add_property('checkout_history', relation(CheckoutEntry.mapper, t_customer_tours, primaryjoin=Customer.c.cust_id==CustomerTour.c.cust_id, secondaryjoin=and_(CustomerTour.c.start_date <= CheckoutEntry.c.ts_checkout,

Re[2]: [Sqlalchemy-users] Many to Many Relationship with ;secondaryjoin' Failing

2006-04-23 Thread Gambit
primaryjoin=info_table.c.pk==rel_table.c.info_pk, > secondaryjoin=rel_table.c.data_pk==data_table.c.pk)) > On Apr 23, 2006, at 8:39 AM, Gambit wrote: >> Hey All, >> >> I'm trying to reproduce, almost exactly, the many to many >> relation

[Sqlalchemy-users] Documentation Format and Edits

2006-04-23 Thread Gambit
Hey All, and Mike in particular - I occasionally find things that I'd like to change in the documentation, such as adding "Example : Short Description Of Code Snippet" to all the code blocks for easy both easy referencing and direct linking. I'm happy enough to do this, if someone cares to lay ou

Re[8]: [Sqlalchemy-users] Problem with SELECT ... FOR UPDATE;

2006-04-03 Thread Gambit
on as well (which, if I understand correctly, is what a engine.begin() does -- an honest to goodness transaction). Isn't the idea of the session.begin_transaction() something to establish UOW transactions, not DB transactions? Or am I just completely reading that wrong? Cheers :) -G On Tuesday, Apr

Re[6]: [Sqlalchemy-users] Problem with SELECT ... FOR UPDATE;

2006-04-03 Thread Gambit
Hey Michael, Just looking at your usage there, but would it make any sense at all to have engine.begin() and engine.push_session() turn into one method? Does it make sense to create multiple sessions if you're not going to be doing simultaneous transactions? I think I'm looking for a way to some

Re: [Sqlalchemy-users] AttributeError on refresh()

2006-04-01 Thread Gambit
Thanks Michael - this was in revision 1234, I'll check out the latest this evening. --G At 00:33 02/04/2006, Michael Bayer wrote: gambit - you have a lazyloader on an object that is failing to clear properly, its a bug. try out the latest trunk, since i was just changing that stuff a

[Sqlalchemy-users] AttributeError on refresh()

2006-04-01 Thread Gambit
Hi guys - I'm working on a hard-to-trace down AttributeError thrown when I try to objectstore.refresh() one of my central objects. I've created a trial test case, which sadly _does_not_fail_, but at least demonstrates my usage. I'm looking for angles to approach this problem from; sadly the

Re: [Sqlalchemy-users] cascade_mapper does not support multiple joins

2006-03-26 Thread Gambit
ous join, perhaps youre looking for explicit join conditions ? http://www.sqlalchemy.org/docs/ adv_datamapping.myt#adv_datamapping_relations_customjoin On Mar 26, 2006, at 1:05 PM, Gambit wrote: Hi guys - I'm not sure this is a bug or not, but if not it might be worth adding a comment to

[Sqlalchemy-users] cascade_mapper does not support multiple joins

2006-03-26 Thread Gambit
Hi guys - I'm not sure this is a bug or not, but if not it might be worth adding a comment to the documentation. Using the following schema: table A: pk B_fk_1 B_fk_2 ... table B: pk info After setting up A and B correctly (see attachment), and

[Sqlalchemy-users] A long time for reflection...

2006-03-12 Thread Gambit
Hi guys -- Just svn'ed up the latest source and I noticed a return to the extremely long time for reflection, on the order of around 63 seconds for twenty odd tables, with a fair number of foreign keys and such. The backend is a PostgreSQL 8.1 server running on my WinXP workstation. Looking

Re: [Sqlalchemy-users] Schema Tracking and Changeset generation

2006-03-06 Thread Gambit
like a VersionedTable or something like that. as for SQLAlchemy core id say its out of scopeSA has a big enough task as it is right now. On Mar 6, 2006, at 2:34 PM, Gambit wrote: Hi guys - I'm looking at various tools for tracking schema changes on the backend database and generate cha

[Sqlalchemy-users] Schema Tracking and Changeset generation

2006-03-06 Thread Gambit
Hi guys - I'm looking at various tools for tracking schema changes on the backend database and generate change scripts for user upgrades. There's a handful of tools out there, most of them fairly expensive, but I thought I'd ask if SQLAlchemy could be used for this kind of purpose. With the