[sqlalchemy] Re: remote nondirect access to DB

2006-12-08 Thread ml
Client application doesn't mean web application and SqlAlchemy would be a too big hammer for SQL console (in my opinion). Well it will be an information system written with wxPython running on multiple computers. I don't want users to see information for direct access to the database. I was

[sqlalchemy] guessing sql joins from object level

2006-12-08 Thread che
Hi, I am trying to translate to sqlalchemy my queries having on object level clauses like the a.b.c.d == some_value where a is instance of class A, b - instance of class B and... How such queries can be expressed in sqlalchemy code (supposing that every class is mapped to its own table)? Are

[sqlalchemy] Re: ForeignKey and onupdate/ondelete

2006-12-08 Thread Manlio Perillo
Michael Bayer ha scritto: use ForeignKeyConstraint. Yes, I have used it. But why ForeignKey does not allow this? Regards Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] Re: SA 0.3.x: performance issues = proposal

2006-12-08 Thread Sébastien LELONG
As attachement, here's the patch (against rev 2132). It's local to sqlalchemy/orm/, so: cd /sqlalchemy/orm patch -p0 attribute_cache.patch About the patch itself: 1. the cache should be a WeakKeyDictionary OK, done. Performances are still OK, differences between built-in dict are

[sqlalchemy] Re: Using pickle to save reflected metadata

2006-12-08 Thread shday
I still get the error: Traceback (most recent call last): File U:/ADA_tools/pickle_tables.py, line 27, in ? pickle.dump(metadata_to_pickle,pfile) File C:\Python24\lib\pickle.py, line 1382, in dump Pickler(file, protocol, bin).dump(obj) File C:\Python24\lib\pickle.py, line 231, in

[sqlalchemy] Re: guessing sql joins from object level

2006-12-08 Thread Michael Bayer
SA can form joins between tables automatically if the tables express the proper foreign key relationship between each other, and if there is no ambiguity in that relationship; i.e. table A and table B have only one ForeignKeyConstraint (or single ForeignKey) between each other. if you have table

[sqlalchemy] Re: ForeignKey and onupdate/ondelete

2006-12-08 Thread Michael Bayer
it was modeled after SQL CREATE TABLE syntax itself, where the ForeignKey keyword looks like column REFERENCES sometable(othercolumn) and does not allow any ON UPDATE or ON DELETE clauses at that level; they would be declared at the bottom of the table def inside the CONSTRAINT foo FOREIGN KEY...

[sqlalchemy] Re: Using pickle to save reflected metadata

2006-12-08 Thread Michael Bayer
latest trunk, this test works for me: from sqlalchemy import * meta = BoundMetaData('mysql://user:[EMAIL PROTECTED]/dbname') table = Table('foo', meta, autoload=True) meta2 = MetaData() t2 = table.tometadata(meta2) import pickle pickle.dumps(meta2) post your test case (with some sample

[sqlalchemy] Re: problem with mapper relationship

2006-12-08 Thread Michael Bayer
the test object you are loading in the update function is local to the update function itself. when the function completes, test falls out of scope and is removed from the session (since it is weakly referenced in the session). a change needs to be made to session whereby dirty objects dont get

[sqlalchemy] count()

2006-12-08 Thread Alexandre CONRAD
Hello, I would like to query a big table and display the information. But at the top of the list I'm going to display, I need a little counter that tell how many items where returned. What would be the most efficient way to count the results ? client_list = session.query(Client).select()

[sqlalchemy] assign_mapper breaks polymorphic multi-table inheritance in 3.1?

2006-12-08 Thread Ken Kuhlman
I'm trying to use assign_mapper with polymorphic multiple table inheritance, and running into problems with the primary key sequencing. Is this a supported use of sqlalchemy? I'm running version 0.3.1. Sample code below. If use_assign_mapper is false, then the script works with both postgres

[sqlalchemy] Re: problem with mapper relationship

2006-12-08 Thread Manlio Perillo
Michael Bayer ha scritto: the test object you are loading in the update function is local to the update function itself. when the function completes, test falls out of scope and is removed from the session (since it is weakly referenced in the session). a change needs to be made to

[sqlalchemy] Re: count()

2006-12-08 Thread Michael Bayer
if you are going to fetch all results in all cases, then len(result) is fine. if the result list is enormous and youre only going to fetch a small portion of it within a request, the count() query as a separate operation is better. --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: Using pickle to save reflected metadata

2006-12-08 Thread shday
whoops... I've been using IDLE to test this and I guess it has to be reopened in order for imports to be redone (I was just closing the shell window). pickle.dump(metadata) works fine now. But now I get a (recursive?) error when I try to unpickle (and I have to kill the shell): import pickle

[sqlalchemy] Re: PickleType with custom pickler

2006-12-08 Thread dmiller
On Dec 8, 2006, at 1:30 PM, Michael Bayer wrote: the reason that get_history calls attribute_manager.get_history is because all awareness of attribute history is handled by the attribute module. the reason attribute_manager then calls the InstrumentedAttribute off of the class is because

[sqlalchemy] Re: PickleType with custom pickler

2006-12-08 Thread Michael Bayer
while youre free to make your own InstrumentedAttribute, i think that is a long uphill battle which also might be incompatible with new releases. I think you might want to go with sticking some hidden attributes on your pickleable object so that your custom PickleType can just use those to

[sqlalchemy] Re: SQL Alchemy

2006-12-08 Thread Robin Munn
On 12/4/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Can you use real numbers and date into SQL Alchemy database? In a word: yes. For real numbers, you'd use the Float() column type, and for dates, you'd use the Date() column type. (Or the DateTime() column type if you wanted both a date and

[sqlalchemy] Re: remote nondirect access to DB

2006-12-08 Thread ml
Jonathan Ellis píše v Pá 08. 12. 2006 v 11:05 -0700: On 12/7/06, ml [EMAIL PROTECTED] wrote: I want to have a client application accessing a remote Postgres database but I don't want to distribute the user/password to the DB. I want clients to authenticate against some other table of

[sqlalchemy] Re: remote nondirect access to DB

2006-12-08 Thread Jonathan Ellis
On 12/8/06, ml [EMAIL PROTECTED] wrote: Jonathan Ellis píše v Pá 08. 12. 2006 v 11:05 -0700: On 12/7/06, ml [EMAIL PROTECTED] wrote: I want to have a client application accessing a remote Postgres database but I don't want to distribute the user/password to the DB. I want clients to

[sqlalchemy] Re: PickleType with custom pickler

2006-12-08 Thread Michael Bayer
this is a simple example of what youre trying to do. its not even as fancy as what i described above and just uses a threadlocal to keep track of the current Session: from sqlalchemy import * from sqlalchemy.orm.session import object_session from cStringIO import StringIO from pickle import

[sqlalchemy] Re: remote nondirect access to DB

2006-12-08 Thread ml
Jonathan Ellis píše v Pá 08. 12. 2006 v 15:40 -0700: On 12/8/06, ml [EMAIL PROTECTED] wrote: Jonathan Ellis píše v Pá 08. 12. 2006 v 11:05 -0700: On 12/7/06, ml [EMAIL PROTECTED] wrote: I want to have a client application accessing a remote Postgres database but I don't want to

[sqlalchemy] Re: Proposal: session identity_map no longer weak referencing

2006-12-08 Thread Jonathan Ellis
On 12/8/06, Michael Bayer [EMAIL PROTECTED] wrote: when SA was first released, someone immediately suggested that the identity map of Session be weak referencing, which appeared to be an obvious improvement, so that you could load as many objects as you want from the session and whatever you