Re: [sqlalchemy] Re: Strange ObjectDeletedError

2011-02-09 Thread Romy Maxwell
I never did understand the pros or cons of running autocommit=True, aside from this flushing issue. Are there performance implications ? On Mon, Feb 7, 2011 at 1:22 PM, Michael Bayer mike...@zzzcomputing.com wrote: I actually just did a little bit of reverse course on this in 0.7.   I've moved

[sqlalchemy] Association object

2011-02-09 Thread Enrico Morelli
Dear all, I've to create an association object where the many-to-many relation has to be created with only one table: atominfo_table = Table('atom_info', metadata, Column('id', types.Integer, primary_key=True), Column('number', types.Integer, nullable=False), Column('coord_x',

Re: [sqlalchemy] Association object

2011-02-09 Thread Enrico Morelli
On Wed, 9 Feb 2011 10:34:22 +0100 Enrico Morelli more...@cerm.unifi.it wrote: mapper(AtomInfo, atominfo_table, properties={ 'residue': relationship(ResidueInfo, backref='atominfo'), 'periodic': relationship(Periodic, backref='atominfo'), 'atom1':

[sqlalchemy] how would you do that with SQLAlchemy ..?

2011-02-09 Thread Julien Cigar
Hello, I'm implementing an authentication system in my webapp, with the usual users / roles. I have a table human, a table role and a table human_role. I have one special user anonymous which has no password, no email, etc and two special roles : anonymous user and authenticated user. If

Re: [sqlalchemy] Re: Strange ObjectDeletedError

2011-02-09 Thread Michael Bayer
sure, you commit too often, and if you're expiring too, then you're re-selecting all the time. On Feb 9, 2011, at 3:54 AM, Romy Maxwell wrote: I never did understand the pros or cons of running autocommit=True, aside from this flushing issue. Are there performance implications ? On Mon,

Re: [sqlalchemy] Association object

2011-02-09 Thread Michael Bayer
On Feb 9, 2011, at 4:34 AM, Enrico Morelli wrote: Dear all, I've to create an association object where the many-to-many relation has to be created with only one table: atominfo_table = Table('atom_info', metadata, Column('id', types.Integer, primary_key=True), Column('number',

Re: [sqlalchemy] Re: dynamic classes and tables

2011-02-09 Thread Michael Bayer
On Feb 9, 2011, at 1:52 AM, farcat wrote: Thank you, that works. Is there any way to later add or remove attributes, using the declarative system? add yes, just plug them on, http://www.sqlalchemy.org/docs/orm/extensions/declarative.html#defining-attributes, removal not so much since the

[sqlalchemy] Insert time/date into sqlite

2011-02-09 Thread anonymous
Hello, I have the following table in sqlite: date DATE field1 VARCHAR(100) field2 VARCHAR(100) I'd like to insert the current date/time into this table: result = DBSQLITE.execute (INS, date = strftime(%Y-%m-%d %H:%M:%S, gmtime()), field1 = string1, field2 = string2) But it doesn't work - I get

[sqlalchemy] AttributeError: 'NoneType' object has no attribute 'groups'

2011-02-09 Thread dalia
Hi, I'm very new to sql alchemy..want help in debugging my code. I'm writing a web application using pylons, formalchemy and sqlalchemy. The issue is as follows - I've 2 tables namely source and pstn. i've declared them as follows - class Source(Base): __tablename__ = 'source' id =

Re: [sqlalchemy] Insert time/date into sqlite

2011-02-09 Thread Michael Bayer
SQLite doesn't have a DATE type specifically. SQLAlchemy's Date() type expects Python datetime, i.e. import datetime; date = datetime.date(year, month day). In this case if you want to put a date + time that would be Sqlalchemy DateTime(), you'd use datetime.datetime(), or if you want to deal

Re: [sqlalchemy] AttributeError: 'NoneType' object has no attribute 'groups'

2011-02-09 Thread Michael Bayer
It seems like your issue is that a query is executing and you are expecting a certain result, but you are not getting it. So there's not a lot of relevant detail here for someone that doesn't have your application open in front of them (test data, exact code that produces query, illustration

[sqlalchemy] Creating table with oracle

2011-02-09 Thread Eduardo
Hi, I want to create the following table: Table('Error', metadata, Column('Type', String), Column('reference', String), Column('context', String), Column ('Timestamp', DateTime, primary_key=True),) with the oracle DB. I receive this: sqlalchemy.exc.Error:

[sqlalchemy] Passing sessions around

2011-02-09 Thread Brent McConnell
I'm having issues with the sqlalchemy session and completely realize this is from my own lack of understanding but can't seem to find a solution. My plan was to create a library with functions like so... def func1 (id, session=None): result = do somework session.add(something)

Re: [sqlalchemy] Creating table with oracle

2011-02-09 Thread Michael Bayer
String() needs a length with Oracle, MySQL, and several others. On Feb 9, 2011, at 10:39 AM, Eduardo wrote: Hi, I want to create the following table: Table('Error', metadata, Column('Type', String), Column('reference', String), Column('context', String),

Re: [sqlalchemy] Passing sessions around

2011-02-09 Thread Michael Bayer
On Feb 9, 2011, at 12:01 PM, Brent McConnell wrote: I'm having issues with the sqlalchemy session and completely realize this is from my own lack of understanding but can't seem to find a solution. My plan was to create a library with functions like so... def func1 (id, session=None):

Re: [sqlalchemy] Passing sessions around

2011-02-09 Thread Michael Bayer
On Feb 9, 2011, at 1:59 PM, Brent McConnell wrote: Thanks for the quick reply. I've tried to include more specific info from my program for you to look over as well as the log. def approve_request(self, request_ids, session=None): if session is None: session =

Re: [sqlalchemy] Logging raw SQL statements

2011-02-09 Thread Michael Bayer
On Feb 9, 2011, at 2:58 PM, George V. Reilly wrote: Under SQLAlchemy 0.5, there used to be some logging setting that would show the actual SQL queries that were being made. Alas, I forget the exact invocation. Under SA 0.6, I have not been able to find a way to do this, short of hacking the

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

2011-02-09 Thread Michael Bayer
OK that ticket is complete if you feel like trying the default tip or 0.6 branch: 0.6: http://hg.sqlalchemy.org/sqlalchemy/archive/rel_0_6.tar.gz tip: http://hg.sqlalchemy.org/sqlalchemy/archive/default.tar.gz On Feb 9, 2011, at 12:52 AM, Michael Bayer wrote: Yeah, thats because the

Re: [sqlalchemy] Logging raw SQL statements

2011-02-09 Thread George V. Reilly
The combination of create_engine(..., echo=True) and logging.basicConfig(level=logging.DEBUG) logging.getLogger('sqlalchemy').setLevel(logging.DEBUG) does the trick for me now. Thanks! /George -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

Re: [sqlalchemy] Logging raw SQL statements

2011-02-09 Thread Michael Bayer
in theory that would log all statements twice, only one should be needed. On Feb 9, 2011, at 5:33 PM, George V. Reilly wrote: The combination of create_engine(..., echo=True) and logging.basicConfig(level=logging.DEBUG) logging.getLogger('sqlalchemy').setLevel(logging.DEBUG) does the