[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
Sure. I am going to leave it until Monday or Tuesday as I hope by that time to return to my work on getting the Sybase driver to pass the test cases. I was away on vacation until last Monday and found it difficult to get back into coding until of course I was confronted by this issue! Thanks agai

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread Michael Bayer
any chance of producing a *small* test case for this phrrn...@googlemail.com wrote: > > Yes, the erroneous behavior goes away when this code is commented out. > No, an empty instrumentation manager *does not cause* the error. Note > that I had a sqlalchemy Table object called 'attributes' in my

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
Yes, the erroneous behavior goes away when this code is commented out. No, an empty instrumentation manager *does not cause* the error. Note that I had a sqlalchemy Table object called 'attributes' in my model. I have changed the code so that I do not import 'attributes' from sqlalchemy.orm but in

[sqlalchemy] Re: Generating a _BinaryExpression

2009-04-03 Thread az
well... the thing is an AST of a very simple language - python-like expressions (and that is not SQL! e.g. a.b.c == x.y.z && whateverelse). u can do with that AST whatever u want - save/load or translate into something else, that is, another grammar. u can build a gui builder/editor over the t

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread Michael Bayer
phrrn...@googlemail.com wrote: > > # class AttachNotesAsDocstring(interfaces.InstrumentationManager): > # def instrument_attribute(self, class_, key, attr): > # if isinstance(attr.property, properties.ColumnProperty): > # if hasattr(attr.property.columns[0], 'info'): > #

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread Michael Bayer
if you implement some kind of __getattr__() method which raises an exception, Python will usually squash it if you say hasattr(x, 'foo'). it interprets every exception, not just AttributeError, as "no such attribute". I think py3k might change this behavior. But if you're seeing exceptions mag

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
Not sure if this is relevant? As you might have guessed from my posts, I am at the 'waving a dead chicken' around stage of debugging. pjjH (Pdb) import pickle (Pdb) print pickle.dumps(m) *** PicklingError: Can't pickle : it's not found as sqlalchemy.orm.properties.Comparator (Pdb) import sqlalc

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
I don't see any output from it at all. I am calling it after importing everything but before making any queries. The mapper registry looks unsurprising (albeit based on a guess of what it does) pjjH from sqlalchemy.orm import compile_mappers s = MySession(bind=e) print compile_mappers() q = s

[sqlalchemy] Re: Possible caching problem

2009-04-03 Thread Michael Bayer
Toby Bradshaw wrote: > > I wasn't aware SQLAlchemy had any kind of cache built in but I do seem > to be seeing some behaviour that sure looks like it. > > I have an SQA/cherrypy app which shares the DB with another app using > MySQLdb only. Updates in the thirdparty are visible to the thirdparty >

[sqlalchemy] Re: _should_log_info - Setting up logging correctly.

2009-04-03 Thread Michael Bayer
Toby Bradshaw wrote: > > Well problem worked around by using echo=True for dev builds and thanks > for your suggestion. > > Your statement: > >> Doing setLevel() etc. you have to do > before any SQLAlchemy code is imported > > Unfortunately doesn't seem to help since the logging module later repor

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread Michael Bayer
what does compile_mappers() say?can you call this mapper, and at the same time all mappers within the entire application have been called ? phrrn...@googlemail.com wrote: > > I copied the list of import statements from the module file > (deshaw.dbo.chimera) to the driver file. The driver fi

[sqlalchemy] Re: Generating a _BinaryExpression

2009-04-03 Thread Christiaan Putter
Hi Svil, My integration between traits and sqlalchemy is working rather well (at least it's passing the unit tests I could think of). Thanks for all your help on that. Now I'm trying to do something similar to what you did in dbcook with expressions. I'd like to construct a gui for the user to

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
OK. This appears to be the source of the problem. You may recall a couple of weeks ago that I was looking for information on how to surface comments from the database metadata into the sqlalchemy model and into docstrings in mapped classes? I took your suggestion and modified it slightly. When I c

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
I did RTFM at http://www.python.org/doc/2.5.2/ref/import.html and now have the symbols explicitly enumerated in the __all__ attribute in the module. However, I am still getting this error when I attempt to do an ORM query on any of these: q = s.query(_ForeignKey).filter(_ForeignKey.FKTABLE_NAME

[sqlalchemy] Possible caching problem

2009-04-03 Thread Toby Bradshaw
I wasn't aware SQLAlchemy had any kind of cache built in but I do seem to be seeing some behaviour that sure looks like it. I have an SQA/cherrypy app which shares the DB with another app using MySQLdb only. Updates in the thirdparty are visible to the thirdparty immediately. They're not visib

[sqlalchemy] Re: _should_log_info - Setting up logging correctly.

2009-04-03 Thread Toby Bradshaw
Well problem worked around by using echo=True for dev builds and thanks for your suggestion. Your statement: > Doing setLevel() etc. you have to do before any SQLAlchemy code is imported Unfortunately doesn't seem to help since the logging module later reports: "No handlers could be found for

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
So I guess that symbols starting with underscore ('_') are treated differently in Python when it comes to be exporting/importing? Sorry to be such a newb but this is the only conclusion I can (rationally!) come to. Traceback (most recent call last): File "chimera_driver.py", line 42, in q

[sqlalchemy] Re: Odd-looking error AttributeError: 'RelationProperty' object has no attribute 'strategy' when *working* code is moved to another file

2009-04-03 Thread phrrn...@googlemail.com
I copied the list of import statements from the module file (deshaw.dbo.chimera) to the driver file. The driver file also has a line: from deshaw.dbo.chimera import * Note that this is happening with a particular class, DatabaseTable, *not* with other classes I have declared and mapped such as Da

[sqlalchemy] Re: Insertion issues

2009-04-03 Thread Tanmoy
Actually i did put 'Company_ID':'Joe' and i could run it.please try putting in mysql and let me know if there is a issue. Tom --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post

[sqlalchemy] Re: Rollback error in the first query of the session.

2009-04-03 Thread Josh Winslow
On Apr 3, 10:13 am, "Michael Bayer" wrote: > Josh Winslow wrote: > > > On Apr 2, 9:21 pm, Michael Bayer wrote: > >> On Apr 2, 4:41 pm, Josh Winslow wrote: > > >> > This is the stack trace: > >> > > >> > ⇝  InvalidRequestError: The transaction is inactive due to a > >> rollb

[sqlalchemy] Re: Rollback error in the first query of the session.

2009-04-03 Thread Michael Bayer
Josh Winslow wrote: > > On Apr 2, 9:21 pm, Michael Bayer wrote: >> On Apr 2, 4:41 pm, Josh Winslow wrote: >> >> > This is the stack trace: >> > >> > ⇝  InvalidRequestError: The transaction is inactive due to a >> rollback >> > in a subtransaction. Issue rollback() to cancel

[sqlalchemy] Re: Insertion issues

2009-04-03 Thread King Simon-NFHD78
> -Original Message- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of Tanmoy > Sent: 03 April 2009 14:30 > To: sqlalchemy@googlegroups.com > Subject: [sqlalchemy] Re: Insertion issues > > import sqlalchemy > from sqlalchemy import * > > engine = cr

[sqlalchemy] Re: Insertion issues

2009-04-03 Thread Tanmoy
import sqlalchemy from sqlalchemy import * engine = create_engine('mysql://root:voxta...@localhost/stock') metadata = MetaData() users=Table('NSE', metadata, Column('Company_ID',String(40),primary_key=True), Column('10:00',Numeric(8,2)), ) metadata.create_all(engine) conn = eng

[sqlalchemy] Re: Insertion issues

2009-04-03 Thread Mike Conley
conn = eng.connect() conn.execute(users.insert(), [{'name':'joe', '10:00':'1200'}]) -- Mike Conley On Fri, Apr 3, 2009 at 12:07 AM, Tanmoy wrote: > Tried that...dosent work > > > > > Tom > > > > --~--~-~--~~~---~--~~ You received this mess

[sqlalchemy] Re: Rollback error in the first query of the session.

2009-04-03 Thread Josh Winslow
On Apr 2, 9:21 pm, Michael Bayer wrote: > On Apr 2, 4:41 pm, Josh Winslow wrote: > > > This is the stack trace: > > > > ⇝  InvalidRequestError: The transaction is inactive due to a rollback > > in a subtransaction. Issue rollback() to cancel the transaction. > > clear this >