Re: [sqlalchemy] MapperExtension.append_result ....

2011-02-08 Thread Martijn Moeling
Michael, I took a look at the recipe you indicated, it looks promising but the check should be constructed from database results. Another issue is that this project is implemented in my web based desktop/Os which uses SQLAlchemy from the bottem up. So modifiing the session object globally is

Re: [sqlalchemy] MapperExtension.append_result ....

2011-02-08 Thread Michael Bayer
On Feb 8, 2011, at 6:05 AM, Martijn Moeling wrote: Michael, I took a look at the recipe you indicated, it looks promising but the check should be constructed from database results. Another issue is that this project is implemented in my web based desktop/Os which uses SQLAlchemy from

Re: [sqlalchemy] MapperExtension.append_result ....

2011-02-08 Thread Martijn Moeling
Michael, Thank you, The final solution has nothing to do with ACL's or addresses and security for others getting results by querying is a none issue. As mentioned before I am building a database and tools to help chemists selecting molecule structures. It is all way more complex than you might

[sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Martijn Moeling
Hi, I am having a small issue with multiple python modules and declarative... I might miss something but Consider: a.py: 8--- Base = declarative_base() class A(Base): ... 8--- b.py Base = declarative_base() class B(Base):

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Michael Bayer
On Feb 8, 2011, at 1:19 PM, Martijn Moeling wrote: Hi, I am having a small issue with multiple python modules and declarative... I might miss something but Consider: a.py: 8--- Base = declarative_base() class A(Base): ...

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Martijn Moeling
Michael, Do you ever sleep? I am not sure I get your point. How do I set up a common Base. I could do Base= Declarative_base() from a import A (or * not sure how this differs in this case) from b import B (or *) If I do not declare Base in module a I get an Import Error on class A(Base),

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Chris Withers
Hi Martin, On 08/02/2011 19:25, Martijn Moeling wrote: I am not sure I get your point. How do I set up a common Base. I could do Base= Declarative_base() from a import A (or * not sure how this differs in this case) from b import B (or *) If I do not declare Base in module a I get an Import

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Michael Bayer
the idea is like this: myproject/ myproject/__init__.py myproject/meta.py myproject/somepackage/__init__.py myproject/somepackage/a.py myproject/someotherpackage/__init__.py myproject/someotherpackage/b.py myproject/__init__.py: from myproject.somepackage import a from

[sqlalchemy] dynamic classes and tables

2011-02-08 Thread farcat
Hi everyone, I am new to sqlalchemy and figuring out whether it is right for my project. What I am looking for is the ability to change classes and tables on the flight, with as much freedom as possible, potentially having metaclasses figuring out the difference between versions and updating the

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Martijn Moeling
Clear, if all packages are in the same project that is.. and what if in a.py I want to inherit some class mapped with b.py mixin does not allways work as a solution subclassing (DeclarativeMeta) is an option, not sure Once I do a base=declarative_base(metadata=BaseB) every class

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Michael Bayer
On Feb 8, 2011, at 3:57 PM, Martijn Moeling wrote: Clear, if all packages are in the same project that is.. and what if in a.py I want to inherit some class mapped with b.py mixin does not allways work as a solution subclassing (DeclarativeMeta) is an option, not sure Once

Re: [sqlalchemy] Declarative, Imports and Base

2011-02-08 Thread Martijn Moeling
Clear! On Feb 8, 2011, at 10:21 PM, Michael Bayer wrote: On Feb 8, 2011, at 3:57 PM, Martijn Moeling wrote: Clear, if all packages are in the same project that is.. and what if in a.py I want to inherit some class mapped with b.py mixin does not allways work as a solution

[sqlalchemy] Problem with table reflection (version 0.6.6) with mysql database

2011-02-08 Thread Paul Rigor
Hello, I have a table with the following schema: +-+---+--+-+-++ | Field | Type | Null | Key | Default | Extra | +-+---+--+-+-++ | acc | varchar(1024) |

Re: [sqlalchemy] Problem with table reflection (version 0.6.6) with mysql database

2011-02-08 Thread Michael Bayer
include_columns is a list of strings indicating the names of those columns which you'd like reflected. If you want to reflect all columns from the table, leave that argument out. On Feb 8, 2011, at 4:36 PM, Paul Rigor wrote: Hello, I have a table with the following schema:

Re: [sqlalchemy] dynamic classes and tables

2011-02-08 Thread Michael Bayer
On Feb 8, 2011, at 3:52 PM, farcat wrote: Hi everyone, I am new to sqlalchemy and figuring out whether it is right for my project. What I am looking for is the ability to change classes and tables on the flight, with as much freedom as possible, potentially having metaclasses figuring out

[sqlalchemy] Custom UTC DateTime Type with Custom insert functionality

2011-02-08 Thread chris e
To simplify date handling in a project on which I am working, I am storing UTC dates in the database in a timestamp with timezone field, however, because cx_Oracle does not have any timezone functionality, I need to cast the UTC timestamp I'm inserting into the database as a timestamp in UTC so

[sqlalchemy] Re: Problem with table reflection (version 0.6.6) with mysql database

2011-02-08 Thread Paul Rigor
Hello, The same error happens with version 0.6.0 as well as 0.5.8. Although for 0.5.8, the error message is different (see below). Note also that the version of the Mysql python driver is 1.2.3. Thanks!!! QLAlchemy-0.5.8-py2.6.egg/sqlalchemy/databases/mysql.pyc in reflect(self, connection,

Re: [sqlalchemy] Custom UTC DateTime Type with Custom insert functionality

2011-02-08 Thread Michael Bayer
On Feb 8, 2011, at 4:56 PM, chris e wrote: To simplify date handling in a project on which I am working, I am storing UTC dates in the database in a timestamp with timezone field, however, because cx_Oracle does not have any timezone functionality, I need to cast the UTC timestamp I'm

[sqlalchemy] Re: Custom UTC DateTime Type with Custom insert functionality

2011-02-08 Thread chris e
I now have the code below, but the _oracle_utc_timestamp function is never called, even when I do explicitly set a value. class UTCTimestamp(TypeDecorator): impl = TIMESTAMP # add the UTC time zone info to naive timestamps def process_result_value(self, value, dialect) : if

Re: [sqlalchemy] Re: Custom UTC DateTime Type with Custom insert functionality

2011-02-08 Thread Michael Bayer
The TypeDecorator is not used for defaults. You set default=utc_timestamp() on your Column.The SQL expression is rendered directly in the INSERT when no value given, no bind params used. On Feb 8, 2011, at 10:13 PM, chris e wrote: I now have the code below, but the

[sqlalchemy] Re: Custom UTC DateTime Type with Custom insert functionality

2011-02-08 Thread chris e
I understand that's the case for defaults, but to test the code I actually set a value for one of the columns that is of type UTCTimestamp, and the compiler extension was never called. I'm stumped. That said, I can keep moving, I've decided to just use oracle timestamps without timezones, and

Re: [sqlalchemy] Re: Custom UTC DateTime Type with Custom insert functionality

2011-02-08 Thread Michael Bayer
Yeah, thats because the compiler extension, wrapped directly around _BindParamClause, is not called on an insert, when the bind is generated within the compile. That is why I made ticket #2042. Not going to work until I get around to that. It would work if you generated the bindparam()

[sqlalchemy] Re: dynamic classes and tables

2011-02-08 Thread farcat
Thank you, that works. Is there any way to later add or remove attributes, using the declarative system? Cheers, Lars On Feb 8, 10:46 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 8, 2011, at 3:52 PM, farcat wrote: Hi everyone, I am new to sqlalchemy and figuring out