[sqlalchemy] Re: Session does not write updated object attribute (no SQL update) (SA 0.4.6)

2008-10-10 Thread Michael Bayer
On Oct 10, 2008, at 4:25 PM, Hermann Himmelbauer wrote: > > Hi, > I created a custom type that represents a string as list of > int(elements), > e.g.: > > "" <-> [2, 2, 2, 2] > > The class I created looks as follows: > > class IntList(types.TypeDecorator): >"""List of integers that is

[sqlalchemy] Session does not write updated object attribute (no SQL update) (SA 0.4.6)

2008-10-10 Thread Hermann Himmelbauer
Hi, I created a custom type that represents a string as list of int(elements), e.g.: "" <-> [2, 2, 2, 2] The class I created looks as follows: class IntList(types.TypeDecorator): """List of integers that is represented by string in the RDB""" impl=String def process_bind_p

[sqlalchemy] Re: mysql to sqlalchemy table definition in .py file?

2008-10-10 Thread Lukasz Szybalski
On Fri, Oct 10, 2008 at 1:50 AM, <[EMAIL PROTECTED]> wrote: > > On Friday 10 October 2008 02:06:51 Lukasz Szybalski wrote: >> On Tue, Sep 30, 2008 at 2:35 AM, <[EMAIL PROTECTED]> wrote: >> > well it's up to you to extend it to mysql... i don't use mysql, >> > nor i know much about sql anyway; al

[sqlalchemy] Re: auto incrementing -serializable isolation

2008-10-10 Thread Lukasz Szybalski
On Fri, Oct 10, 2008 at 2:06 AM, <[EMAIL PROTECTED]> wrote: > > hi there. > i had similar thread some months ago > http://groups.google.com/group/sqlalchemy/browse_thread/thread/1a3790d58e819f01/4d8e175fc04055aa > the option 2 has 2 subcases. > - one is to keep all numberings in one table and ha

[sqlalchemy] Re: session becomes "sort of" transactional after using begin() / commit()

2008-10-10 Thread Michael Bayer
On Oct 10, 2008, at 10:52 AM, Simon wrote: > > Hi all, > > I have a non-transactional session accessing a MySQL database with > InnoDB tables (SA 0.4.7). It's created via > >> sessionmaker(bind=self.engine, autoflush=True, transactional=False). > > For some queries, I use begin() / commit() for

[sqlalchemy] Re: select count group_by where ?

2008-10-10 Thread Lukasz Szybalski
> group_by does not take a list but all individual columns as parameters > (so just omit those []s). has fixed the error. I think the newer version of sqlachemy no longer has Record.c its just Record.somefield... What also confused me was the fact that in order to do where zyx =2 in query you

[sqlalchemy] Re: InnoDB - Foreign Key must be an Index

2008-10-10 Thread Simon
I'm running on 5.0.51a and InnoDB as well and have had no problems creating references. Here's what I use: referenced = Table('Referenced', self.metadata, Column('id', MSInteger(unsigned=True), primary_key=True), mysql_engine='InnoDB' ) referencing = Table('Referen

[sqlalchemy] Re: Can't attach instance; another instance with key (?)

2008-10-10 Thread az
On Friday 10 October 2008 19:42:19 Doug Farrell wrote: > Hi all, > > I'm using SqlAlchemy 0.5rc1 to track jobs with a sqlite datatabe in > a state machine used by a server. Each job represents a currently > active job in the server and will "be alive" for awhile as it takes > time for the server t

[sqlalchemy] Re: Can't connect to local MySQL server

2008-10-10 Thread morecowbell
make sure your mysqld.sock is in the location mysql expects it to be. default is "/tmp/mysql.sock"; if you are using darwinports, depending on mysql version it's "/opt/local/var/run/mysqld/mysqld.sock" (append mysql version to mysqld). otherwise, head over to forums.mysql.com ; i'm pretty sure t

[sqlalchemy] Re: select count group_by where ?

2008-10-10 Thread Simon
Actually, if TRANS_TYPE is a mapped attribute of the RecordClass class (or whatever its name is), it should be Records.c.TRANS_TYPE. Also, group_by does not take a list but all individual columns as parameters (so just omit those []s). On 10 Okt., 17:38, "Lukasz Szybalski" <[EMAIL PROTECTED]> wro

[sqlalchemy] Re: infinity with mysql backend

2008-10-10 Thread Simon
MySQL apparently is unable to store infinity in float columns, so SA can't do it either. Google have me this: http://forums.mysql.com/read.php?39,220571,220573#msg-220573 On 9 Okt., 18:22, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a sqlalchemy table with a float column, and I would

[sqlalchemy] Can't attach instance; another instance with key (?)

2008-10-10 Thread Doug Farrell
Hi all, I'm using SqlAlchemy 0.5rc1 to track jobs with a sqlite datatabe in a state machine used by a server. Each job represents a currently active job in the server and will "be alive" for awhile as it takes time for the server to process each job. When a job is done it is removed from the sy

[sqlalchemy] Re: select count group_by where ?

2008-10-10 Thread Lukasz Szybalski
On Fri, Oct 10, 2008 at 10:32 AM, Simon <[EMAIL PROTECTED]> wrote: > > The statement looks good in my book...what does "system error" mean > exactly? > > On 10 Okt., 17:15, "Lukasz Szybalski" <[EMAIL PROTECTED]> wrote: >> Hello, >> Could anybody tell me what is wrong with this select statement? >>

[sqlalchemy] Re: select count group_by where ?

2008-10-10 Thread Simon
The statement looks good in my book...what does "system error" mean exactly? On 10 Okt., 17:15, "Lukasz Szybalski" <[EMAIL PROTECTED]> wrote: > Hello, > Could anybody tell me what is wrong with this select statement? > > Records is a mapper. > > group=sqlalchemy.select([Records.TRANS_TYPE,Records

[sqlalchemy] Re: OrderingList and list.sort()

2008-10-10 Thread jason kirtland
Adam Dziendziel wrote: > Hi, > > It seems that sorting of ordering list doesn't work. Attribute > object.items is an OrderingList: > > object.items.sort(cmp=my_cmp) > > The list is sorted, but the ordering column is not updated. I need to > call explicitly: > > object.items._reorder() > > May

[sqlalchemy] select count group_by where ?

2008-10-10 Thread Lukasz Szybalski
Hello, Could anybody tell me what is wrong with this select statement? Records is a mapper. group=sqlalchemy.select([Records.TRANS_TYPE,Records.TR_DATE,func.count(Records.TR_DATE).label('date_count')], Records.TRANS_TYPE==29).group_by([Records.TRANS_TYPE,Records.TR_DATE]).execute().fetchall() I

[sqlalchemy] Re: SA 0.5 rc1 - Mysql Unicode(1) decode error

2008-10-10 Thread jason kirtland
Martijn Moeling wrote: > Hi > > > > I needed a Unicode(1) Column in one of my tables. > > > > It was translated into a char(1) column in MySQL. > > > > When querying the table, I get a: AttributeError: 'Set' object has no > attribute 'decode' > > > > Which disappears if I make th

[sqlalchemy] session becomes "sort of" transactional after using begin() / commit()

2008-10-10 Thread Simon
Hi all, I have a non-transactional session accessing a MySQL database with InnoDB tables (SA 0.4.7). It's created via > sessionmaker(bind=self.engine, autoflush=True, transactional=False). For some queries, I use begin() / commit() for explicit transactions. However, after commit()ing, SQLAlche

[sqlalchemy] Re: object_session(remote_device_object) returns noneType

2008-10-10 Thread Michael Bayer
On Oct 10, 2008, at 8:03 AM, Heston James - Cold Beans wrote: > Morning guys, > > When calling object_session(my_object), it returns a NoneType object > so I’m unable to call commit() and close() on the session, what does > this mean? Does it mean my object is not attached to a session? > > M

[sqlalchemy] Re: ratio on multiple tables

2008-10-10 Thread Michael Bayer
On Oct 9, 2008, at 10:01 PM, John Hunter wrote: > To simplify the problem, I have written code that simply connects the > "reportdate" of the fundamental data with a give price data point, eg > > class PriceData(Base): > __tablename__ = 'price_data' > > ticker = sa.Column(sa.String(12), prim

[sqlalchemy] SA 0.5 rc1 - Mysql Unicode(1) decode error

2008-10-10 Thread Martijn Moeling
Hi I needed a Unicode(1) Column in one of my tables. It was translated into a char(1) column in MySQL. When querying the table, I get a: AttributeError: 'Set' object has no attribute 'decode' Which disappears if I make the column a Unicode(2), so there might be a small bug in the M

[sqlalchemy] object_session(remote_device_object) returns noneType

2008-10-10 Thread Heston James - Cold Beans
Morning guys, When calling object_session(my_object), it returns a NoneType object so I'm unable to call commit() and close() on the session, what does this mean? Does it mean my object is not attached to a session? My understanding is that if I did something like: my_object = session.q

[sqlalchemy] Re: ratio on multiple tables

2008-10-10 Thread John Hunter
On Thu, Oct 9, 2008 at 9:01 PM, John Hunter <[EMAIL PROTECTED]> wrote: >> if the attribute is "attached" to either PriceData or FundamentalData, >> the general route towards this kind of thing is to use >> column_property(). You can place subqueries which correlate to the >> base table in those

[sqlalchemy] Re: auto incrementing

2008-10-10 Thread az
hi there. i had similar thread some months ago http://groups.google.com/group/sqlalchemy/browse_thread/thread/1a3790d58e819f01/4d8e175fc04055aa the option 2 has 2 subcases. - one is to keep all numberings in one table and have a somewhat twisted query+update mechanism (Sequence if u have it, or