[sqlalchemy] Re: Looking for a pattern/simple way to simplify parsing and storing files in a database

2009-01-13 Thread az
u can make a simple dict-cache for your authors only, and let it grow. in case of limited memory, u can do more sophisticated statistical one (say keep recent 1000 authors, or most used ones or whatever criterion) and query db if not there and create new one if not there either. But if it's

[sqlalchemy] Looking for a pattern/simple way to simplify parsing and storing files in a database

2009-01-13 Thread Nathan Harmston
Hi everyone, I m trying to get to grips with SQLAlchemy by parsing a file, extracting certain fields and then storing them in a database. I am currently using the object relational and trying to get a sense of how it all works. I have two objects Paper and Author, which is a many to many

[sqlalchemy] Re: ORM base class for 0.5?

2009-01-13 Thread Christoph Haas
Thanks for the code. For those who might also be interested in an ORM base class providing __init__, update and __repr__ - this is what I use now with 0.5 (comments welcome): = import sqlalchemy as sql from sqlalchemy import orm class

[sqlalchemy] Re: How best to handle metadata in WSGI framework

2009-01-13 Thread PacSci
No, I'm going to use a template layout. I'm not sure how I'm going to organize it is clear to you, so it might be better to give an example: Say Bob has a Web site, so he creates a project named bobsite. For the site, he finds three applications other people have written - aguestbook,

[sqlalchemy] Re: How best to handle metadata in WSGI framework

2009-01-13 Thread az
may or may not be relevant, those n- apps may have same-named tables that have nothing to do with each other, e.g. Item. so either separate metadata's or separate schema's if they are supported... and the latter is not easily made transparent into the apps - if they all expect a table called

[sqlalchemy] Re: How best to handle metadata in WSGI framework

2009-01-13 Thread Michael Bayer
the metadata is just a dictionary, and is basically a namespace where a program can find Table objects based on their name. it should be in as narrow a scope as possible, and should not be considered to have any relationship to a database engine or connection - its ability in that regard

[sqlalchemy] [Decl. Layer] Multiple mappers for one table?

2009-01-13 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is it possible to define multiple mappers for one table? Usecase: I have one big table (60 cols) and one big mapper class. For some reporting I don't need only a small number of cols. For performance reasons I would like to load the related rows

[sqlalchemy] How to query with aggregate function?

2009-01-13 Thread Chen Houwu
I am not very familiar with SqlAlchemy, now I have a problem to query with aggregate function. Here is the class -- class Directory(DeclarativeBase): An ultra-simple group definition. __tablename__ = 'docman_directory' dir_id = Column(Integer,

[sqlalchemy] Re: [Decl. Layer] Multiple mappers for one table?

2009-01-13 Thread Michael Bayer
On Jan 13, 2009, at 8:19 AM, Andreas Jung wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is it possible to define multiple mappers for one table? Usecase: I have one big table (60 cols) and one big mapper class. For some reporting I don't need only a small number of cols. For

[sqlalchemy] Re: How to query with aggregate function?

2009-01-13 Thread Michael Bayer
On Jan 13, 2009, at 9:46 AM, Chen Houwu wrote: I am not very familiar with SqlAlchemy, now I have a problem to query with aggregate function. Here is the class -- class Directory(DeclarativeBase): An ultra-simple group definition. __tablename__ =

[sqlalchemy] Re: [Decl. Layer] Multiple mappers for one table?

2009-01-13 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 13.01.2009 15:52 Uhr, Michael Bayer wrote: On Jan 13, 2009, at 8:19 AM, Andreas Jung wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is it possible to define multiple mappers for one table? Usecase: I have one big table (60 cols)

[sqlalchemy] Re: [Decl. Layer] Multiple mappers for one table?

2009-01-13 Thread Michael Bayer
On Jan 13, 2009, at 10:04 AM, Andreas Jung wrote: This fails: This is full-fledged mapper: class Arbeitsmittel(Base, AsDictMixin): __tablename__ = 'arbeitsmittel' __table_args__ = ( { 'autoload' : True, }) # column redefinitions needed for

[sqlalchemy] Re: MySQL longtext column type

2009-01-13 Thread jonEbird
Indeed, you are correct. When I use the adjusted statement of: Column('data', Text(4294967295), nullable=False) The column type was created as longtext. Sorry for the trouble, I thought I had tried that before. Thank you, Jon Miller On Jan 9, 8:13 pm, Michael Bayer mike...@zzzcomputing.com

[sqlalchemy] 0.5: how set tzinfo=utc on timestamps as default?

2009-01-13 Thread _tyr_
some columns have type timestamp without time zone. In this case its a utc-Timestamp. Its possible to set tzinfo=utc by default (in SA) if I have a timestamp without time zone column reflected? Thx. --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: 0.5: how set tzinfo=utc on timestamps as default?

2009-01-13 Thread Michael Bayer
not sure what effect this would have ? we don't use a tzinfo argument anywhere. only the sqlite dialect actually generates datetime objects and there's similarly no explicit notion of timezone there either. On Jan 13, 2009, at 11:04 AM, _t...@arcor.de wrote: some columns have type

[sqlalchemy] Re: 0.5.0 polymorphic merge problem or bug

2009-01-13 Thread Duder
Ok I was wrong about the problem being present in the merge() function. The problem is only present in my custom merge() function. Thanks for your help. On Jan 13, 12:08 am, Duder dthomp...@gmail.com wrote: I am using the merge() function to merge the de-serialized object into the session. I

[sqlalchemy] Re: Column('last_updated', onupdate=func.current_timestamp())

2009-01-13 Thread atomburner
Mr. Bayer, you know entirely too much about all kinds of databases. A follow-up question to your erudite comment (and let me first say that I love sqlalchemy and have spent a good amount of time immersed in its documentation before posting): I tried running an update query of the form