[sqlalchemy] Failures with AssociationProxy (starting with r2598)

2007-06-12 Thread Paul Kippes
Starting with r2598, I'm seeing some failures with how I'm using the association proxy. I've modified the examples/association/proxied_association.py file which duplicates the problem. It is possible that I'm not suppose to remove associations like I am. But it did work before (in 0.3.7 and

[sqlalchemy] Re: Failures with AssociationProxy (starting with r2598)

2007-06-12 Thread Michael Bayer
Ive added ticket #597 for this. On Jun 12, 2:22 am, Paul Kippes [EMAIL PROTECTED] wrote: Starting with r2598, I'm seeing some failures with how I'm using the association proxy. I've modified the examples/association/proxied_association.py file which duplicates the problem. It is possible

[sqlalchemy] Re: Failures with AssociationProxy (starting with r2598)

2007-06-12 Thread Paul Kippes
Would you write a failing test for this condition? I looked at the unit tests but wasn't able to make a failing test. So that is why I modified the example. I also tried to formulate a work around. And failed at that as well. On 6/12/07, Michael Bayer [EMAIL PROTECTED] wrote: Ive added

[sqlalchemy] Re: Failures with AssociationProxy (starting with r2598)

2007-06-12 Thread Michael Bayer
On Jun 12, 2007, at 11:13 AM, Paul Kippes wrote: Would you write a failing test for this condition? I looked at the unit tests but wasn't able to make a failing test. So that is why I modified the example. I also tried to formulate a work around. And failed at that as well. we have a

[sqlalchemy] Re: PROPOSAL: whack query.select(), selectfirst(), selectone(), select_by(), selectfirst_by(), selectone_by(), get_by(), auto-join feature

2007-06-12 Thread Jonathan Ellis
Cleaning out my inbox... FWIW I'm +1 on removing the old-style methods, +1 on .first instead of .scalar, +1 on adding .one, and +0 on renaming .list to .all. Did you make a decision for 0.4 Mike? -J --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] Re: PROPOSAL: whack query.select(), selectfirst(), selectone(), select_by(), selectfirst_by(), selectone_by(), get_by(), auto-join feature

2007-06-12 Thread Gaetan de Menten
On 6/12/07, Michael Bayer [EMAIL PROTECTED] wrote: we have, in fact, made a tip of the hat to SAT analogy questions (selecting everything is to all() as selecting just the first row is to: a. scalar() b. first() c. list()[0]). I've already said it earlier but since you didn't comment on

[sqlalchemy] Query.get with unordered multiple-column-primary-key

2007-06-12 Thread Gaetan de Menten
Hi, Anybody knows how I could emulate the behavior of Query.get (ie get the result from the session if possible instead of always fetching from the db) if I have the values for the different columns of the primary as keyword arguments (ie not in the order of the columns of the initial table)? I

[sqlalchemy] Re: dictionaries collection_class

2007-06-12 Thread sdobrev
the legal way is the association_proxy and family. here another shorter ... a hack: i did have similar need - obj.somerelation.append( left=.., right=..), so i did monkeypatch the InstrumentedList's append to use the item returned from collection's append - def append( self, *args,

[sqlalchemy] Re: Problems with non existing relations

2007-06-12 Thread voltron
actually, I am iterating through all the databases in the meta ti = model.meta.table_iterator() for t in ti: print create %s ? % t if raw_input(Choose [Y/n]).lower() in ['y','']: t.create() I want to be able to chose which database to create from a pool on

[sqlalchemy] Re: dictionaries collection_class

2007-06-12 Thread Ron
Using the association_proxy extension in combination with your dictionary collection class is an easy way to get this kind of simplified access. Assuming your Attribute's value is in a property called 'value', you can set up simple dict access like so: class Obj(object): attrs =

[sqlalchemy] Re: dictionaries collection_class

2007-06-12 Thread jason kirtland
Ron wrote: When I try the above I get this error at flush time: InvalidRequestError: Class 'str' entity name 'None' has no mapper associated with it Here is my dictionary collection_class: class AttributeDictNEW(dict): My Attribute Dict def append(self, item):

[sqlalchemy] Re: dictionaries collection_class

2007-06-12 Thread Ron
The association proxy will take care of Attribute construction for you, so you can get away with just: class AttributeDictNEW(dict): def append(self, item): self[item.key] = item def __iter__(self): return self.itervalues() So now I if I try to get something

[sqlalchemy] ONLY NOW! Special price bid - you can buy new web page on HALF price!!!

2007-06-12 Thread GPcapital
I do not want to cheat anybody. I'm a student and made that web page in my spare time. My web page GPCapitalGroup.com has spent about 100 hours and my direct costs reach approximatelly $200 only for buying webhosting and domain. In case, you would like to buy that web page with or without domain

[sqlalchemy] mssql reflection NoSuchTableError

2007-06-12 Thread one.person
Hello all I am experimenting with SA on MSSQL and am having difficulty with table reflection as outlined in the tutorial, for instance: from sqlalchemy import * db = create_engine('mssql://login:[EMAIL PROTECTED]/db') metadata = BoundMetaData(db) users_table = Table('users', metadata,

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread Rick Morrison
Just tried it here on a Linux + pymssql box and it worked fine. The 'NoSuchTable' error would indicate that the table is not found, as you surmised. Check to make sure the table is really persisting after your first session with the table create. In the meantime, I'll see if I can get pymssql

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread one.person
one.person View profile More options Jun 12, 5:12 pm From: one.person [EMAIL PROTECTED] Date: Wed, 13 Jun 2007 00:12:50 - Local: Tues, Jun 12 2007 5:12 pm Subject: Re: mssql reflection NoSuchTableError Reply | Reply to author | Forward | Print | Individual message | Show original |

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread Rick Morrison
Works in Windows, too, sqlalchemy 0.3.8, Python 2.5, pymssql 0.8.0, MSSQL 2005 Try upgrading your pymssql if you're not at 0.8.0. If that won't work, then I would suggest a switch to pyodbc Rick On 6/12/07, one.person [EMAIL PROTECTED] wrote: one.person View profile More

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread one.person
So all of the above was done with Windows XP, Python 2.4.3, pymssql 0.7.4, and MSSQL 2000. I upgraded to pymssql 0.8.0 with the same results. I uninstalled that and installed pyodbc 2.0.3.6, same results. The obvious differences between my installation and yours is that I am using MSSQL 2000

[sqlalchemy] Re: Problems with non existing relations

2007-06-12 Thread Michael Bayer
un 12, 3:59 pm, voltron [EMAIL PROTECTED] wrote: actually, I am iterating through all the databases in the meta ti = model.meta.table_iterator() for t in ti: print create %s ? % t if raw_input(Choose [Y/n]).lower() in ['y','']: t.create() I want to be

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread Michael Bayer
On Jun 12, 9:04 pm, one.person [EMAIL PROTECTED] wrote: So all of the above was done with Windows XP, Python 2.4.3, pymssql 0.7.4, and MSSQL 2000. I upgraded to pymssql 0.8.0 with the same results. I uninstalled that and installed pyodbc 2.0.3.6, same results. The obvious differences

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread one.person
Thanks for all the quick replies. Currently on pyodbc 2.0.3.6. Anyway, I tried this (the table 'zones' most definitely exists): metadata.engine.echo = True zones_table = Table('zones', metadata, autoload=True) 2007-06-12 18:20:40,924 INFO sqlalchemy.engine.base.Engine.0x..b0 SET nocount ON

[sqlalchemy] Re: mssql reflection NoSuchTableError

2007-06-12 Thread Rick Morrison
That looks OK to me. Try pasting that query (cleaned-up) into a query window on Enterprise Manager and see what kind of results you get. The ? arguments are positional, so the first would be the table 'zone'; the second the schema 'dbo'. On 6/12/07, one.person [EMAIL PROTECTED] wrote:

[sqlalchemy] Erroneous primary key of in-memory instance after session flush?

2007-06-12 Thread David Bolen
I was converting an older table definition from using an integer primary key to a string (representation of UUID), and ran into a bit of strange behavior, where my object instance's String primary key receives an integer value (which appears to be the internal sqlite rowid) after a flush. From

[sqlalchemy] Trying to detect which class methods were added by the mapper.

2007-06-12 Thread Ian Charnas
Inspired by the SQLAlchemy docs, I'm writing a documentation generator in python using a combination of epydoc (for parsing/introspection), genshi (templates), docutils (for restructured text), and pygments (syntax highlighting).. and I just noticed that the documentation for classes mapped by