[sqlalchemy] Many-to-Many Adjacency Relationships

2007-12-07 Thread Bert Wesarg
Hello all, I need a little help, guidance to get a Many-to-Many Adjacency Relationships, a.k.a. a dependency graph working. Here is the short code: metadata = MetaData('sqlite:///') tasks_table = Table('tasks', metadata, Column('id', Integer, primary_key = True), Column('name',

[sqlalchemy] Re: Slow relation based assignment.

2007-12-07 Thread Martin Pengelly-Phillips
Hello again Michael, Have read the documentation you referenced, but am still unsure how to now delete a Tag without generating the following error: (Note - using Postgres in production) (IntegrityError) update or delete on tags violates foreign key constraint employeesTags_tag_id_fkey on

[sqlalchemy] Re: Question about an ORM query with an aggregate function

2007-12-07 Thread Allen Bierbaum
I forgot to mention, I am using SA 0.3.10. Thanks, Allen On Dec 7, 2007 7:49 AM, Allen Bierbaum [EMAIL PROTECTED] wrote: I am trying to create two queries with some of my SA ORM objects that will use the sum of a field found through a relationship. To be a bit more concrete, here is a

[sqlalchemy] Question about an ORM query with an aggregate function

2007-12-07 Thread Allen Bierbaum
I am trying to create two queries with some of my SA ORM objects that will use the sum of a field found through a relationship. To be a bit more concrete, here is a simple setup similar to mine. # table object users_table = Table('users', meta, Column('user_id', Integer, primary_key=True),

[sqlalchemy] Query problem with chars acute or grave

2007-12-07 Thread Expo
I'am using SA 0.3.11 with MySql 5.0 through MySQLdb latest stable version and I don't get results when searching string with chars acute or grave like è, é, à. I haven't found flags on SA or MySQLdb for support exotic chars, I have miss something ?

[sqlalchemy] Re: IMPORTANT: Does SA caches objects in memory forever?

2007-12-07 Thread Michael Bayer
On Dec 7, 2007, at 1:17 AM, Arun Kumar PG wrote: I used weak ref dict and doing a session.clear() post every request. But when I do a len(gc.get_objects()) post every request I can see that the number of objects keeps on increasing. Do we have a background thread that frees up the

[sqlalchemy] Re: Key error when mapping against arbitrary select

2007-12-07 Thread Michael Bayer
fixed in r3867. your code below will still raise an exception, just a more decriptive one. On Dec 7, 2007, at 6:35 AM, Andrew Stromnov wrote: persons_table = Table(u'persons', dbconfig.metadata, Column(u'person_id', Integer(20), primary_key=True, autoincrement=True, nullable=False,

[sqlalchemy] Design: mapped objects everywhere?

2007-12-07 Thread Paul-Michael Agapow
More of a design question, complicated by the fact that I'm a database neophyte (although I've used SA a fair bit). I have a web application that with periodically connect to a database. I've written a wrapper for the db using SQLalchemy, but I'm unsure about the best way to use the mapped

[sqlalchemy] dynamic relations

2007-12-07 Thread Vladimir Iliev
hi, what's wrong with the attached example? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send

[sqlalchemy] Re: Stats implementation question.

2007-12-07 Thread Andrew Stromnov
I think it shoud be done throught mapping against arbitrary select ( http://www.sqlalchemy.org/docs/04/documentation.html#advdatamapping_mapper_selects ). Thanks. On 7 дек, 13:23, Andrew Stromnov [EMAIL PROTECTED] wrote: How to implement this stat behaviour (RPG-like stats): players_table =

[sqlalchemy] Key error when mapping against arbitrary select

2007-12-07 Thread Andrew Stromnov
persons_table = Table(u'persons', dbconfig.metadata, Column(u'person_id', Integer(20), primary_key=True, autoincrement=True, nullable=False, default=0), Column(u'level', Integer(11), nullable=False, default=1), autoload = False) class Person(object): pass mapper(Person,

[sqlalchemy] Stats implementation question.

2007-12-07 Thread Andrew Stromnov
How to implement this stat behaviour (RPG-like stats): players_table = Table('player', Column('id', Integer, primary_key=True), Column('name', String), Column('level', Integer), ) # SELECT 'level', count('level') as 'count' FROM player ORDER BY 'level' GROUP BY 'level' # class

[sqlalchemy] Re: IMPORTANT: Does SA caches objects in memory forever?

2007-12-07 Thread King Simon-NFHD78
Felix Schwarz wrote: I have a question which I think is similar enough to be asked in the same thread: I have a set of quite simple migration scripts which us SQLAlchemy 0.4 and Elixir 0.4. I do extract data from the old legacy (MySQL) database with SQLAlchemy and put this data into

[sqlalchemy] Re: Slow relation based assignment.

2007-12-07 Thread Michael Bayer
On Dec 7, 2007, at 5:21 AM, Martin Pengelly-Phillips wrote: Hello again Michael, Have read the documentation you referenced, but am still unsure how to now delete a Tag without generating the following error: (Note - using Postgres in production) (IntegrityError) update or delete on

[sqlalchemy] Re: Query problem with chars acute or grave

2007-12-07 Thread jason kirtland
Expo wrote: I'am using SA 0.3.11 with MySql 5.0 through MySQLdb latest stable version and I don't get results when searching string with chars acute or grave like è, é, à. I haven't found flags on SA or MySQLdb for support exotic chars, I have miss something ? There is an option to MySQLdb

[sqlalchemy] Re: Question about an ORM query with an aggregate function

2007-12-07 Thread Allen Bierbaum
Thanks for the feedback. I hadn't thought of doing it this way. I did comb through the documentation a 2nd and 3rd time today though and found the add_column() method for queries. It looks like that may be another way to get what I want. I am thinking about even creating a little builder

[sqlalchemy] Re: Design: mapped objects everywhere?

2007-12-07 Thread Paul Johnston
Hi, A Sample may be created by the web application or fetched from the database. Later on, it may be disposed of, edited or checked back into the db. On the other hand, the requirements and coding of both classes are kinda different, and I find myself changing the properties of the

[sqlalchemy] From arbitrary SELECT to Query

2007-12-07 Thread Artur Siekielski
I have a compound SELECT statement (of class CompoundSelect) that is composed of a few normal SELECTs combined by UNION. from_obj of this SELECT contains all columns of a table that is mapped to a class. I would like to get objects created using defined mapper, but selected using my compound

[sqlalchemy] Re: dynamic relations

2007-12-07 Thread Michael Bayer
im glad people are finally using dynamic relationstry out rev 3869. On Dec 7, 2007, at 10:25 AM, Vladimir Iliev wrote: from sqlalchemy import * from sqlalchemy.orm import * metadata = MetaData('sqlite://') #~ metadata.bind.echo = 'debug' companies = Table('companies', metadata,

[sqlalchemy] Re: Design: mapped objects everywhere?

2007-12-07 Thread sdobrev
Paul Johnston wrote: Hi, A Sample may be created by the web application or fetched from the database. Later on, it may be disposed of, edited or checked back into the db. On the other hand, the requirements and coding of both classes are kinda different, and I find myself changing

[sqlalchemy] Re: dynamic relations

2007-12-07 Thread Vladimir Iliev
i'm glad you're always so responsive ;-) Michael Bayer написа: im glad people are finally using dynamic relationstry out rev 3869. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] Re: From arbitrary SELECT to Query

2007-12-07 Thread Michael Bayer
On Dec 7, 2007, at 2:39 PM, Artur Siekielski wrote: I have a compound SELECT statement (of class CompoundSelect) that is composed of a few normal SELECTs combined by UNION. from_obj of this SELECT contains all columns of a table that is mapped to a class. I would like to get objects

[sqlalchemy] Re: Slow relation based assignment.

2007-12-07 Thread Martin Pengelly-Phillips
hey Mike, Thanks for the update - I'll try it out tomorrow. Martin p.s. Have I mentioned you guys provide the best support I have encountered in a long time (including commercial products). On Dec 7, 4:14 pm, Michael Bayer [EMAIL PROTECTED] wrote: hey martin - this bug is fixed in trunk