[sqlalchemy] Re: Append column

2010-03-15 Thread YAD
Thank you, please'll show where to find a working example of sqlalchemy-migrate. Because the examples of official documentation does not work, for example: def upgrade (): table.data.create () AttributeError: 'Table' object has no attribute 'data' On Mar 13, 6:10 pm, Michael Bayer

[sqlalchemy] multiple connections

2010-03-15 Thread Andrew
Hi, I have a problem where multiple connections to a MySQL database (through sqlalchemy from a cherrypy multithreaded web server) get different views on the same data. Scenario: A user submits a form to create a new record in a table Cherrypy adds the record and

[sqlalchemy] in_() operator is not currently implemented for many-to-one-relations - alternatives?

2010-03-15 Thread Stodge
I have two classes with a third table: document_tags = Table('document_tags', metadata, Column('document_id', Integer, ForeignKey('documents.id')), Column('tag_id', Integer, ForeignKey('tags.id')) ) class Document(Base): __tablename__ = 'documents' id =

[sqlalchemy] Re: multiple connections

2010-03-15 Thread Andrew
I may have found the problem. It turns out this problem only occurs if I use the cherrypy auth_basic to provide authentication. In my authentication checkpassword function I was querying the user table without using sessions. Adding a session rollback, clear and close to the end of this

[sqlalchemy] Re: multiple connections

2010-03-15 Thread Andrew
Ok... looks like I was hasty. The problem still seems fixed so far - but my reasoning seems wrong. It looks like the authentication request is contained within the transaction - so I don't see why doing a select on a table within the authentication function would cause problems. However adding a

Re: [sqlalchemy] in_() operator is not currently implemented for many-to-one-relations - alternatives?

2010-03-15 Thread Michael Bayer
Stodge wrote: I have two classes with a third table: document_tags = Table('document_tags', metadata, Column('document_id', Integer, ForeignKey('documents.id')), Column('tag_id', Integer, ForeignKey('tags.id')) ) class Document(Base): __tablename__ = 'documents'

Re: [sqlalchemy] Re: multiple connections

2010-03-15 Thread Michael Bayer
it sounds like you are coming up against basic transaction isolation behavior. some background is available at http://dev.mysql.com/doc/refman/5.1/en/innodb-transaction-model.html . if you wanted to turn it off, you could use MyISAM tables or use your session with autocommit=True. Andrew

[sqlalchemy] Re: multiple connections

2010-03-15 Thread Andrew
Thanks - and sorry for all this brain dump - I figure it could be useful to others! It looks like I was correct before - I have a bug where for static content (the images I mentioned earlier) I do not create a transaction- however the authentication needed one really. Thanks, Andrew On Mar 15,

[sqlalchemy] Re: in_() operator is not currently implemented for many-to-one-relations - alternatives?

2010-03-15 Thread Stodge
Thanks. I wrote the error message from memory, the exact wording is: session.query(Document).filter(Document.tags.in_(tag_list)) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.6/site-packages/sqlalchemy/sql/ expression.py, line 1274, in in_ return

[sqlalchemy] composite index using declarative

2010-03-15 Thread Daniel Robbins
Hi All, How does one define a composite index using declarative? Quick example? Couldn't find any examples in the docs or online. In my particular case, id will be a primary key, and I'd like a composite UniqueConstraint on group_id and name, and a composite index on group_id (pos 1) and name

[sqlalchemy] pymssql issues with nvarchar ntext

2010-03-15 Thread Tan Yi
pymssql does not suport reading in nvarchar and ntext since it is encoded as unicode in sqlserver. is any API could convert the query result into Unicode? Tried 'convert_unicode' argument in create_engine, and it seems not working. Thank you! --Tony -- You received this message

Re: [sqlalchemy] composite index using declarative

2010-03-15 Thread Michael Bayer
Daniel Robbins wrote: Hi All, How does one define a composite index using declarative? Quick example? Couldn't find any examples in the docs or online. In my particular case, id will be a primary key, and I'd like a composite UniqueConstraint on group_id and name, and a composite index on

Re: [sqlalchemy] pymssql issues with nvarchar ntext

2010-03-15 Thread Michael Bayer
Tan Yi wrote: pymssql does not suport reading in nvarchar and ntext since it is encoded as unicode in sqlserver. is any API could convert the query result into Unicode? Tried 'convert_unicode' argument in create_engine, and it seems not working. Thank you! the old version of pymssql

[sqlalchemy] confusion with outer join setup

2010-03-15 Thread Jonathan Vanasco
hi. i'm trying to join two tables in sqlalchemy for a query, and having an issue. from what I understand , it seems that the SQL which is generated is fine ( and it does run if i 'print' and substitute in variables ) -- the problem is that due to my structuring of how I handle date ranges, the

Re: [sqlalchemy] composite index using declarative

2010-03-15 Thread Daniel Robbins
On Mar 15, 2010, at 4:58 PM, Michael Bayer wrote: we have some index examples at http://www.sqlalchemy.org/docs/metadata.html#indexes . the Index is not related to declarative and is specified separately. Any plans to improve this? I would have thought that Indexes would be defined under