[Sqlalchemy-users] SQL-API and SQLAlchemy

2006-05-09 Thread Clark C. Evans
A few months past, Ian Bicking (of SQLObject fame) presented an idea for a SQL-API which would overlap significantly with SQLAlchemy. The goal is to represent SQL as Python objects and provide other helpful features (such as information schema introspection) which are not part of DB-API. What is im

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

2006-05-09 Thread Marty McFly
Actually, it might get a little bit more complicated than that, because I would like to allow the users to choose who can comment on their posts, for example: all people, only logged in people, only friends, ... So, for the posts the overhead probably gets big because it depends on the identity

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

2006-05-09 Thread Evan Rosson
It looks like at least one other person has stepped up to mentor this project, and I have also just thrown my hat in the ring, so I am fairly confident someone will end up taking this project on. Great to hear! I had wondered if anything was going on in the mentor-only project comments. ;) I a

Re: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Huy Do
Jonathan Ellis wrote: On 5/9/06, *Luís Bruno* <[EMAIL PROTECTED] > wrote: Huy Do wrote: > I always do a session.clear() after I do my stored procs/triggers. Which just reminded me of PostgreSQL notifications. Maybe watching for those and reload the obj

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

2006-05-09 Thread Sandro Dentella
Thanks for the clear explanation, Mike. Sadly this demostrate that I may have badly choosen the instrument. I'm building a mask to edit tables, possibly views of different tables, I want people be able to add filtering conditions on any field, issue the query, get the result and possibly edit it

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

2006-05-09 Thread Michael Bayer
if you change the bottom to this: ret = m.select(and_( users.c.user_id == mails.c.user_id , mails.c.mail_address.like('%a%') )) for R in ret: print R.user_name for a in R.mail: print a.mail_address and you get this result: Sam [EMAIL PROTECTED]

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

2006-05-09 Thread Sandro Dentella
On Wed, May 10, 2006 at 01:14:40AM +0300, Gambit wrote: > Hey Sandro, > > Ooh, that's what you meant by doubled rows. > > You're just asking for users where the mail address matches the criteria. If > you want to limit the mail entries then, for a given user, performing an > additional select on

Re: [Sqlalchemy-users] order by

2006-05-09 Thread Michael Bayer
On May 9, 2006, at 7:58 AM, Julien Cigar wrote: cascade_mappers(Invasive.mapper, InvasiveCategory.mapper) // Invasive contains invasivecategory and InvasiveCategory contains invasives cascade_mappers is pretty sketchy, while its working for you in this case, i suggest you dont trust it

Re: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Luis Bruno
Jonathan Ellis wrote: > Notifications are inherently not transaction-safe I really can't come up with another method for the cache to be invalidated, Python-side. Hey! Ken Thompson's on the telly here: something about using brute-force. Thanks for the correction! ---

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

2006-05-09 Thread Gambit
Hey Sandro, Ooh, that's what you meant by doubled rows. You're just asking for users where the mail address matches the criteria. If you want to limit the mail entries then, for a given user, performing an additional select on the mail table backwards (i.e. supplying the limiting userid, or user

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

2006-05-09 Thread Sandro Dentella
On Wed, May 10, 2006 at 12:32:53AM +0300, Gambit wrote: > 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 >

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] order by

2006-05-09 Thread Sandro Dentella
> Invasive.mapper.select_by(order_by=[invasivecategory.category]) > Invasive.mapper.select(order_by=[InvasiveCategory.c.category]) // This > query doesn't fail, but a JOIN is missing ... (why ?) cascade_mappers creates a Lazy loader, ie: data from the second table are only fetched when needed. Yo

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

2006-05-09 Thread Sandro Dentella
Hi, the attached script produces a sql statement that I can't correctly interpret but anyhow gives wrong results (doubled rows): m.select(users.c.user_id == mails.c.user_id, from_obj=[users]) SELECT user_tbl.user_last_name AS user_tbl_user_last_name, mail_tbl_3b11.user_id AS mail

Re: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Ed Suominen
All this talk of parent and child nodes makes me wonder if my SQLAlchemy-based persistence add-on (pNetworkX) to the NetworkX graph package might be of interest. You could use pNetworkX with your chosen database to maintain a directed graph that represents the parent-child relationships between you

Re: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Jonathan Ellis
On 5/9/06, Luís Bruno <[EMAIL PROTECTED]> wrote: Huy Do wrote:> I always do a session.clear() after I do my stored procs/triggers.Which just reminded me of PostgreSQL notifications. Maybe watching forthose and reload the objects specified by the trigger in the notification message (or just invalida

Re: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Luís Bruno
Florian Boesch wrote: Table('children', engine, Column('children_id', Integer, Sequence('children_seq'), primary_key=True), Column('tag_node_id', Integer, ForeignKey('tag_node.id'), nullable=False), Column('node_id', Integer, ForeignKey('node.id'), nullable=False), Column('ordering', Inte

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

[Sqlalchemy-users] order by

2006-05-09 Thread Julien Cigar
Hello, I'm new to sqlalchemy and wondered how could I do this : I have 2 tables (postgresql) : create table invasive_categories ( id serial not null, categoryvarchar(100)not null, constraint pk_category primary key(id) ); create table invasives ( id

[Sqlalchemy-users] Database Migration

2006-05-09 Thread Florian Boesch
Hi, I just had a run-in with our database guy who needed two hours and numerous retries to provide a sql script to move our database to my latest model changes (really simple ones), and it's not all correct even now because he forgot to remove some columns and tables. Anyway, this lead me to the

Re: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Luís Bruno
Huy Do wrote: I always do a session.clear() after I do my stored procs/triggers. Which just reminded me of PostgreSQL notifications. Maybe watching for those and reload the objects specified by the trigger in the notification message (or just invalidate part of the cache) would be a nice ide

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: [Sqlalchemy-users] reverse engineer?

2006-05-09 Thread Florian Boesch
Hm, lemme think, on top of my head you'd need: Table('node_type', engine, Column('node_type_id', Integer, Sequence('node_type_seq'), primary_key=True), Column('name', String(255), nullable=False), ) Table('node', engine, Column('node_id', Integer, Sequence('node_seq'), primary_key=True), Col