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

2008-08-27 Thread Randy Syring
Here is my initial stab at this: http://code.google.com/p/sqlitefktg4sa/ Code plus tests. I welcome your feedback. On Aug 22, 1:48 pm, jason kirtland [EMAIL PROTECTED] wrote: Yep, though possibly you'd want it on before-drop.  You can actually handle both tasks in the same function if you

[sqlalchemy] Documenting SQLAlchemy models with Sphinx fails (table already defined)

2008-08-27 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: error when running query.count()

2008-08-27 Thread ml
Hi! There are more than 1 mapper to an object. Send your mappers configuration. David mkhan napsal(a): 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

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

2008-08-27 Thread Cecil Westerhof
2008/8/27 Michael Bayer [EMAIL PROTECTED]: Is this a good way of doing things, or should I work with severall engines? I dont quite understand how the difference between Query and select() has an impact on using a single or multiple Engine objects.So I'll sum up the two multiple

[sqlalchemy] Displaying table partly in table object

2008-08-27 Thread Cecil Westerhof
I have a program in which I display severall tables. This is partly generic, so I would like to have one general function and put the specific functionality in the object definition itself. For example I have: # kmStandTable = sa.Table( 'kmStand', metadata, sa.Column('datum',

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

2008-08-27 Thread Gaetan de Menten
On Wed, Aug 27, 2008 at 3:21 AM, Randy Syring [EMAIL PROTECTED] wrote: 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

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

2008-08-27 Thread Cecil Westerhof
2008/8/26 Cecil Westerhof [EMAIL PROTECTED]: First I had: for row in engine.execute('SELECT MIN(gewicht) AS gewicht ' ', MIN(vet) AS vet ' ', MAX(water) AS water ' ',

[sqlalchemy] how to get the primary key for newly inserted row?

2008-08-27 Thread manuhack
Hi, Using the example in the tutorial: users = Table('users', metadata, ... Column('id', Integer, primary_key=True), ... Column('name', String), ... Column('fullname', String), ... ) if I commit the following ins = users.insert(values={'name':'jack', 'fullname':'Jack Jones'})

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
Hi Michael, I've switch my definition to the following: class PublicationElement(Entity): using_options(tablename='publication') sections = OneToMany('SectionElement') covers = OneToMany('PublicationCoverElement') publication_id = Field(Integer, primary_key=True) name =

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

2008-08-27 Thread Randy Syring
Gaëtan, Thank you. On Aug 27, 5:23 am, Gaetan de Menten [EMAIL PROTECTED] wrote: On Wed, Aug 27, 2008 at 3:21 AM, Randy Syring [EMAIL PROTECTED] wrote: 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

[sqlalchemy] Re: how to get the primary key for newly inserted row?

2008-08-27 Thread Gustavo Narea
You should map a class to this table. For more information, please read: http://www.sqlalchemy.org/docs/05/ormtutorial.html On Wednesday August 27, 2008 08:25:43 manuhack wrote: Hi, Using the example in the tutorial: users = Table('users', metadata, ... Column('id', Integer,

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
F*ck... I just realized that I was using MyISAM table engine... here's the deal then... I cannot use InnoDB for this projet so I think I will be writing some recursive code that can determine if an object has childs dependencies and will delete the proper objects thanks again =) On Aug

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Michael Bayer
On Aug 27, 2008, at 10:48 AM, Alex Mathieu wrote: F*ck... I just realized that I was using MyISAM table engine... here's the deal then... I cannot use InnoDB for this projet so I think I will be writing some recursive code that can determine if an object has childs dependencies and

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

2008-08-27 Thread Michael Bayer
On Aug 27, 2008, at 3:49 AM, Cecil Westerhof wrote: 2008/8/27 Michael Bayer [EMAIL PROTECTED]: Is this a good way of doing things, or should I work with severall engines? I dont quite understand how the difference between Query and select() has an impact on using a single or multiple

[sqlalchemy] Re: Documenting SQLAlchemy models with Sphinx fails (table already defined)

2008-08-27 Thread Michael Bayer
On Aug 27, 2008, at 2:57 AM, Christoph Haas wrote: 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

[sqlalchemy] Re: Displaying table partly in table object

2008-08-27 Thread Michael Bayer
On Aug 27, 2008, at 5:03 AM, Cecil Westerhof wrote: I have a program in which I display severall tables. This is partly generic, so I would like to have one general function and put the specific functionality in the object definition itself. For example I have: # kmStandTable =

[sqlalchemy] Re: how to get the primary key for newly inserted row?

2008-08-27 Thread manuhack
Gustavo, On Aug 27, 10:32 am, Gustavo Narea [EMAIL PROTECTED] wrote: You should map a class to this table. For more information, please read:http://www.sqlalchemy.org/docs/05/ormtutorial.html Thanks. So far my application uses SQLAlchemy without orm and seems like it's time for me to move

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Bob Farrell
On Wed, Aug 27, 2008 at 07:48:20AM -0700, Alex Mathieu wrote: F*ck... I just realized that I was using MyISAM table engine... here's the deal then... I cannot use InnoDB for this projet so I think I will be writing some recursive code that can determine if an object has childs

[sqlalchemy] Re: how to get the primary key for newly inserted row?

2008-08-27 Thread Michael Bayer
On Aug 27, 2008, at 2:25 AM, manuhack wrote: Hi, Using the example in the tutorial: users = Table('users', metadata, ... Column('id', Integer, primary_key=True), ... Column('name', String), ... Column('fullname', String), ... ) if I commit the following ins =

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
Damn, so why does the cascade statement does not work ? I simply can't get that one... I've been trying all the examples using the cascade argument in the relationships declaration, like you said in your first post, and it won't just work. I just gave it another try, and my Publication element

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Michael Bayer
I'm not fluent with Elixir, but here is a sample script using declarative and SQLite (another database that has a very casual notion of foreign keys) which demonstrates the correct behavior.First convert this script to Elixir (and also to 0.4 if needed, this script is made against

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-27 Thread Alex Mathieu
Thanks Michael, I'll have a look over this !! Bob, thanks also for your help, however, I'm not able to use the code... maybe the indention is wrong here or I don't know... I was able to execute the function, but even by putting a print as the first line of the function, nothing got printed out,

[sqlalchemy] loading tables is very slow

2008-08-27 Thread vkuznet
Hi, I've been trying to profile why loading a single table from remote ORACLE DB takes more then 5 seconds. Here is some numbers: create engine 0.0740728378296 engine.connect 2.05604815483 SELECT table_name FROM all_tables WHERE owner='ZZZ' get tables 0.18466091156 Loading

[sqlalchemy] Re: how to get the primary key for newly inserted row?

2008-08-27 Thread Manu Hack
Michael, On Wed, Aug 27, 2008 at 1:18 PM, Michael Bayer [EMAIL PROTECTED]wrote: On Aug 27, 2008, at 2:25 AM, manuhack wrote: Hi, Using the example in the tutorial: users = Table('users', metadata, ... Column('id', Integer, primary_key=True), ... Column('name',

[sqlalchemy] Re: error when running query.count()

2008-08-27 Thread Mohammed Khan
I think turbogears is maintain the mapper config?... how do I get this information out.. Thanks mfk -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ml Sent: Wednesday, August 27, 2008 2:09 AM To: sqlalchemy@googlegroups.com Subject:

[sqlalchemy] DTOs and RPC

2008-08-27 Thread Arthur Pemberton
I am looking into what are the best practices, common methods of doing things like RPC with SqlAlchemy declarative_base sublcasses. Is there a concept of DTO? Or is this something I would have to build into it myself? Thank you. -- Fedora 7 : sipping some of that moonshine ( www.pembo13.com )

[sqlalchemy] Re: DTOs and RPC

2008-08-27 Thread Michael Bayer
On Aug 27, 2008, at 4:57 PM, Arthur Pemberton wrote: I am looking into what are the best practices, common methods of doing things like RPC with SqlAlchemy declarative_base sublcasses. Is there a concept of DTO? Or is this something I would have to build into it myself? concepts like

[sqlalchemy] wx and SqlAlchemy

2008-08-27 Thread Mike
Hi, I am working on a wxPython application that saves data to various tables in our MS SQL Server 2000. I connect to one table and get data using a session. This works great. I then do a session.close() and then a conn.close() where conn = engine.connect(). This seems to work as expected as

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

2008-08-27 Thread Cecil Westerhof
2008/8/27 Michael Bayer [EMAIL PROTECTED]: OK, then dont bind the engine to your MetaData, thats confusing the issue. Just bind each Session to the appropraite Engine(s). The Session, if not explicitly bound to an engine, gets the engine from the underlying MetaData associated with the

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

2008-08-27 Thread Cecil Westerhof
2008/8/27 Cecil Westerhof [EMAIL PROTECTED]: At this moment I am not working with update and delete. (Just started trying to implement something with sqlalchemy.) But when people would like to know how I am going to solve that, I can post that at the moment I am using those. (I could use

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

2008-08-27 Thread Cecil Westerhof
2008/8/27 Cecil Westerhof [EMAIL PROTECTED]: By the way is there a method to put an AS part in the select? For example: # stmt = sa.select([sa.func.max(KmStand.eindStand)]) print stmt SELECT max(kmStand.eindStand) AS max_1 FROM kmStand # I would like to have: # SELECT