Re: [sqlalchemy] Re: internationalization of content

2010-09-15 Thread werner
Hi Nil, On 14/09/2010 21:58, NiL wrote: Hi Werner, many thanks for your rich reply. I'm going to try an elixir implementation for now. If you want follow the thread of the same title in the elixir mailing list. Thanks for letting me know. One of the things which disturb me about SA or

[sqlalchemy] Declarative classproperty member problem in 0.6.4, not 0.6.3

2010-09-15 Thread Nikolaj
The following test fails in 0.6.4 but not 0.6.3 with AttributeError: type object 'Person' has no attribute 'foo'. Is this a deliberate change? It seems a bit weird that every @classproperty on a declarative subclass is accessed/run on import. from sqlalchemy import create_engine, Column, String

Re: [sqlalchemy] Declarative classproperty member problem in 0.6.4, not 0.6.3

2010-09-15 Thread Michael Bayer
On Sep 15, 2010, at 10:04 AM, Nikolaj wrote: The following test fails in 0.6.4 but not 0.6.3 with AttributeError: type object 'Person' has no attribute 'foo'. Is this a deliberate change? It seems a bit weird that every @classproperty on a declarative subclass is accessed/run on import.

Re: [sqlalchemy] Declarative classproperty member problem in 0.6.4, not 0.6.3

2010-09-15 Thread Chris Withers
On 15/09/2010 15:04, Nikolaj wrote: Base = declarative_base() class Person(Base): __tablename__ = 'people' name = Column(String, primary_key=True) @classproperty def bar(cls): return cls.foo Can you explain why you'd want to do something like this? Chris --

Re: [sqlalchemy] Declarative classproperty member problem in 0.6.4, not 0.6.3

2010-09-15 Thread Michael Bayer
On Sep 15, 2010, at 12:10 PM, Chris Withers wrote: On 15/09/2010 15:04, Nikolaj wrote: Base = declarative_base() class Person(Base): __tablename__ = 'people' name = Column(String, primary_key=True) @classproperty def bar(cls): return cls.foo Can you

[sqlalchemy] Fetching last insert id from MySQL.

2010-09-15 Thread phasma
I've got database with auto increment column called `id` and INSERT query, whom I need to execute without model declaration in project. meta.Session.execute() returns ResultProxy, but last_inserted_ids() doesn't work with execute() and SELECT LAST_INSERT_ID() statement sometimes return 0. Is there

Re: [sqlalchemy] Fetching last insert id from MySQL.

2010-09-15 Thread Michael Bayer
SELECT LAST_INSERT_ID() is ultimately where the value comes from - the raw .lastrowid is present on the ResultProxy for those DBAPIs which support it, so try using that. Perhaps you're getting 0 because the transaction is going away, in which case .lastrowid should solve that issue. On Sep

[sqlalchemy] Re: on padded character fields again

2010-09-15 Thread Victor Olex
You mean something like this: import sqlalchemy.types as types class CHAR(types.TypeDecorator): '''Strips padding from CHAR types. ''' impl = types.CHAR def process_bind_param(self, value, dialect): return value def process_result_value(self, value, dialect):

[sqlalchemy] Trying to walk through tutorial, getting (OperationalError) no such table

2010-09-15 Thread MichelleB
This is driving me crazy since I can't even get through the tutorial : ( Thanks for any help! code, then error below. #! /usr/local/bin/python dbtestpy Walking through sqlalchemy tutorial Author: Michelle Brenner from sqlalchemy import Table, Column, Integer, Float,

[sqlalchemy] Re: Combining aliases with labels

2010-09-15 Thread Jack Kordas
On Sep 9, 9:53 am, Conor conor.edward.da...@gmail.com wrote: On 09/08/2010 01:05 PM, Jack Kordas wrote: When I try to use both aliases and labels, the results are not named as expected. Instead of being able to access the columns as label-name_column- name it appears as

Re: [sqlalchemy] Trying to walk through tutorial, getting (OperationalError) no such table

2010-09-15 Thread Roger Demetrescu
Try moving the metadata.create_all(engine) below the User class declaration. Like: snipped code class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) fullname = Column(String) password = Column(String) def __init__(self, name,

[sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-15 Thread phasma
Lastrowid return: Could not locate column in row for column 'lastrowid'. I try to use transaction: trans = meta.Session.begin() try: meta.Session.execute(INSERT statement) result = meta.Session.execute(SELECT LAST_INSERT_ID()) trans.commit() except: trans.rollback() raise

[sqlalchemy] PostgreSQL, cascading and non-nullable ForeignKeys

2010-09-15 Thread BenH
Hi, I'm using SqlAlchemy 0.6.3 and PostgreSQL 8.4 and I'm trying to setup a cascading delete between several levels of tables. The problem seems to be that I can't have a relationship with cascade=all and a column with ForeignKey that has nullable=False. Here is my example: from sqlalchemy

Re: [sqlalchemy] PostgreSQL, cascading and non-nullable ForeignKeys

2010-09-15 Thread Conor
On 09/15/2010 05:04 PM, BenH wrote: Hi, I'm using SqlAlchemy 0.6.3 and PostgreSQL 8.4 and I'm trying to setup a cascading delete between several levels of tables. The problem seems to be that I can't have a relationship with cascade=all and a column with ForeignKey that has nullable=False.

Re: [sqlalchemy] Re: Fetching last insert id from MySQL.

2010-09-15 Thread Michael Bayer
no its not a column on a row, its on the ResultProxy: result = session.execute('...') id = result.lastrowid http://www.sqlalchemy.org/docs/core/connections.html?highlight=resultproxy#sqlalchemy.engine.base.ResultProxy.lastrowid On Sep 15, 2010, at 5:51 PM, phasma wrote: Lastrowid return: