[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-26 Thread Hermann Himmelbauer
Am Montag 25 August 2008 22:37:47 schrieb Michael Bayer: On Aug 25, 2008, at 12:22 PM, Hermann Himmelbauer wrote: Hi, I'm wondering if the following is possible with mappers: I have two tables A and B, whereas B is referenced by A. What I need is a special mapper for A that returns

[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-26 Thread Hermann Himmelbauer
Am Dienstag 26 August 2008 01:41:20 schrieb David Gardner: I think what you might want to do is something like this: a_query=select([a_table,b_table], b_table.c.sometext!='NOTHISONE').alias('a_query') mapper(AObject, q_query) Interesting, thanks - yes, that might a solution, although, if I

[sqlalchemy] Re: disable polymorphic load

2008-08-26 Thread ml
thats a bug which was fixed post 0.4.7p1. Its in trunk and is for 0.4.8. Great! And back to the mapper properties. As I found it always do a polymorphic_fetch=select-like query when dealing with mapper properties referencing a polymorphic base. This is not very efficient. I would prefer an

[sqlalchemy] catch warning when insert

2008-08-26 Thread menuge
Hi all, I have 2 tables: - info (id: integer, cfg: integer) - info_with_error (id:integer, cfg: varchar(32)) I'd like to check the query before inserting into table. For instance: if I build this query: INSERT INTO info VALUES(STRING) I d like to catch the warning generated during the

[sqlalchemy] SqlAchemy and OpenOffice

2008-08-26 Thread Lukasz Szybalski
Hello, I have created a manual and give example on how to use sqlalchemy and openoffice together to create documents. The code shows you how to use openoffice as a document template and fill in the data from the database. I basically use Find and Replace function of openoffice to do the template

[sqlalchemy] Re: SqlAchemy and OpenOffice

2008-08-26 Thread Empty
I have created a manual and give example on how to use sqlalchemy and openoffice together to create documents. The code shows you how to use openoffice as a document template and fill in the data from the database. I basically use Find and Replace function of openoffice to do the template

[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-26 Thread David Gardner
Uhoh, I had a little typeo, also I believe the join condition may need to be part of the select statement, the two conditions probably should be a list, and then you may need to specify the primaryjoin in the mapper as well. give this a try: a_query=select([a_table,b_table],

[sqlalchemy] Sphinx documentation stumbles upon SQLAlchemy models

2008-08-26 Thread Christoph Haas
Dear list... I'm on a documentation frenzy now in my current Pylons project. And I'm using Sphinx for that purpose. All my controllers and helper functions are documented automatically. Great. Unfortunately Sphinx fails to create module documentation for my models. I'm staying close to the

[sqlalchemy] Re: Aggregate on different subsets

2008-08-26 Thread Kipb
On Aug 23, 2:11 am, OKB [EMAIL PROTECTED] wrote: ... let's say I have a table with columns Firstname, Lastname, and Income.  What I'd like is to get query results where the columns are Firstname, Lastname, Income, sum of incomes of everyone with this Firstname, sum of incomes of everyone with

[sqlalchemy] Re: SqlAchemy and OpenOffice

2008-08-26 Thread Nicolas Évrard
* Lukasz Szybalski [2008-08-26 18:04 +0200]: Hello, Hello, I have created a manual and give example on how to use sqlalchemy and openoffice together to create documents. The code shows you how to use openoffice as a document template and fill in the data from the database. I basically use

[sqlalchemy] error when running query.count()

2008-08-26 Thread mkhan
Hi, I am trying get a count for a query but it errors out with following message: Page handler: bound method Root.index of harvest.controllers.Root object at 0x018444B0 Traceback (most recent call last): File c:\python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy \_cphttptools.py,

[sqlalchemy] Working with several database without needing to know in which database an object resides

2008-08-26 Thread Cecil Westerhof
I just started playing with sqlalchemy. At the moment I am working with one database, but properly I need to work with severall database at the same time, but I want to work in such a way, that I do not need to know in which database a certain table resides. Is this possible? For example it

[sqlalchemy] Orphans not deleted using cascade parameter

2008-08-26 Thread Alex Mathieu
Hi all, I'm using Elixir SQLAlchemy to manage some entities, it's going quite well. However, I just realize that when I was deleting my parents entities, my sons entites were not deleted. The're might be something I didn't get quite well, so that's why I'm requiring some help... Let's say I

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-26 Thread Alex Mathieu
In fact, I think I figured it out how it was working... but I still get this error: class 'sqlalchemy.exceptions.AssertionError': Dependency rule tried to blank-out primary key column 'default_sections.section_id' on instance '[EMAIL PROTECTED]' It appears that it tries to set my foregin key in

[sqlalchemy] Re: SQLite Foreign Key Triggers: how to extend sqlalchemy to generate them

2008-08-26 Thread Randy Syring
Ok, so I was going to try and implement a solution using the method discussed here, but ran into a problem b/c I am using Elixir objects and not declaring the tables directly. Can I still use this method? How do I get the table references from the Elixir objects? Thanks. On Aug 22, 1:48 pm,

[sqlalchemy] Re: Working with several database without needing to know in which database an object resides

2008-08-26 Thread Michael Bayer
On Aug 26, 2008, at 9:56 AM, Cecil Westerhof wrote: And this does what it should do. So I expect that the engine is fetched out of Gewicht. First I had: for row in engine.execute('SELECT MIN(gewicht) AS gewicht ' ', MIN(vet) AS vet '

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-26 Thread Michael Bayer
On Aug 26, 2008, at 6:08 PM, Alex Mathieu wrote: Let's say I have two classes: class PublicationElement(Entity): using_options(tablename='publication') sections = OneToMany('SectionElement') covers = OneToMany('PublicationCoverElement') publication_id = Field(Integer,

[sqlalchemy] Re: disable polymorphic load

2008-08-26 Thread Michael Bayer
On Aug 26, 2008, at 8:24 AM, ml wrote: thats a bug which was fixed post 0.4.7p1. Its in trunk and is for 0.4.8. Great! And back to the mapper properties. As I found it always do a polymorphic_fetch=select-like query when dealing with mapper properties referencing a polymorphic

[sqlalchemy] Re: catch warning when insert

2008-08-26 Thread Michael Bayer
On Aug 26, 2008, at 5:14 AM, menuge wrote: Hi all, I have 2 tables: - info (id: integer, cfg: integer) - info_with_error (id:integer, cfg: varchar(32)) I'd like to check the query before inserting into table. For instance: if I build this query: INSERT INTO info VALUES(STRING) I d

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-26 Thread Harish K Vishwanath
Try putting the cascade=all, delete, delete-orphan on OneToMany side of the Relationship. On Wed, Aug 27, 2008 at 9:05 AM, Michael Bayer [EMAIL PROTECTED]wrote: On Aug 26, 2008, at 6:08 PM, Alex Mathieu wrote: Let's say I have two classes: class PublicationElement(Entity):

[sqlalchemy] Re: catch warning when insert

2008-08-26 Thread Kipb
On Aug 26, 5:14 am, menuge [EMAIL PROTECTED] wrote: I have 2 tables: - info (id: integer, cfg: integer) - info_with_error (id:integer, cfg: varchar(32)) I'd like to check the query before inserting into table. For instance: INSERT INTO info VALUES(STRING) If my query has an error, i put