[sqlalchemy] Re: how to build a model package?

2008-12-23 Thread Jorge Vargas

On Sat, Dec 20, 2008 at 9:34 AM, Etienne Robillard
robillard.etie...@gmail.com wrote:
 On Wed, 17 Dec 2008 02:48:08 -0600
 Jorge Vargas jorge.var...@gmail.com wrote:


 Hello, I have been trying to figure out an alternative to the
 following setup.

 The problem I'm trying to solve is fixing TurboGears project structure
 but I'm sure this is useful for other projects.

 model
 --- __init__.py
 --- foo.py
  bar.py

 in __init__.py we have the initialization of SA, creating
 mapper/session,etc. then both foo and bar import from model the
 session  metadata, now that we need to initialize (bind several
 things) SA before using it, the current solution is to provide a
 function (init_model) that TG itselfs calls when the whole thing is
 loaded, the side effect this has is that we need to import all classes
 at the end of the file, which is at best ugly, but really confusing.

 So my question is, how do you handle a big set of classes that live in
 their own modules but can be imported directly from the package?

 Hi Jorge,

 I'm not sure understanding your question correctly. Do you search
 for ways to improve your model package based on
 sqlalchemy.ext.declarative or using classic SA techniques?

not really, ideally this shouldn't be tied to any syntax, currently
that is all build in in model.__init__.py

 Either ways, I kinda like making a model package (model.py) free of all
 the database-related stuff. I prefer putting theses things in
 database.py, so that its possible to modify the database options
 independently from the model.

I think you got your concept wrong, model.py is a module not a
package, a package is a directory with a __init__.py + several
modules.

If it was just wording yes this is what we are doing now, but we are
talking about big models (think 50+ classes) your model.py will
become huge and potentially messy, and if you split it into several
files you will find that you lose the ability to do from myapp.model
import Foo

 my custom app then look like so:

 mycustomapp/
  - __init__.py
  - model.py
  - database.py

 model.py:

 from sqlalchemy.schema  import MetaData, Table
 from sqlalchemy.ext.declarative import declarative_base

 import some_database as db

 __all__ = ['Base', 'metadata', 'BlogPost']

 Base = declarative_base()
 metadata = MetaData(db.engine)

 class BlogPost(Base):
...

 I suppose the declarative_base() and SA 0.5.x greatly simplifies
 how models gets mapped internally. You can then just import
 your model class normally:

 from mycustomapp.model import BlogPost

 or even:

 import mycustom.model as model

 HTH,

 erob

 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: 0.5 release schedule

2008-12-23 Thread Jorge Vargas

I just launched last week a site running on 0.5rc4, given the quality
of SA releases you shouldn't fear it's not final tag. It's really
stable the only thing that could stop you from deploying is a hard
policy on what goes to prod, by your organization/company/etc.

On Thu, Dec 18, 2008 at 7:54 PM, Michael Bayer mike...@zzzcomputing.com wrote:

 I have put a site into production using 0.5rc4, and its a fairly
 prominent site for a popular TV show.0.5.0 is mostly ready to
 go, I'm holding off on some ORM enhancements to concrete inheritance
 until 0.5.1 since I need to study them further and concrete
 inheritance is not a popular feature.  So what we're waiting for is a
 set of enhancements and fixes to the MS-SQL dialect, which will create
 a change in how URLs work, and then we're good to go.



 On Dec 18, 2008, at 6:02 PM, David Gardner wrote:


 I realize this may not be a fair questions since SA is an open source
 project.

 With that caveat what is the expected release date for 0.5 final?

 I have been developing against the 0.5 release candidates, and will
 probably deploy my code (an internal web app) in the second week of
 January.
 If 0.5 is out by then I will install and deploy that on my production
 server.
 If 0.5 isn't released I'm wondering if I should deploy my code against
 0.4.8  or if I should deploy with 0.5rc4?
 I am probably more comfortable deploying with 0.5rc4 since that is
 what
 I have been developing against, and I am not sure if I have done
 anything that wouldn't work in 0.4.8.

 --
 David Gardner
 Pipeline Tools Programmer, Sid the Science Kid
 Jim Henson Creature Shop
 dgard...@creatureshop.com



 


 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] psycopg2 and Python 2.6

2008-12-23 Thread vctr...@gmail.com

Hi all,

I'm trying to port to python 2.6 with SQLAlchemy over PostgrSQL and it
seems that all is porting BUT the psycopg2 component?

Is anyone aware of a working version of psycopg2 for Linx 64 arch?

In general - does SQLAlchemy support 2.6? I was under the impression
that it does.

Is there another DB (not PostgerSQL) that does work?

Thanks
--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL default_schema

2008-12-23 Thread Rick Morrison
I've got a few concerns with the just-committed get_default_schema_name()
approach:

1) What about pre-2005 users?  The query used in this patch to fetch the
schema name won't work. There was not even a real hard concept of 'schema'
pre-MSSQL-2005.

2) Prior to MSSQL 2005, MSSQL conflated user name and schema name in a
fashion similar to that of Oracle. People use this to override some
tables, because the server search for locating a table in Oracle and MSSQL
is to check the user schema first, then look through a schema search path
looking for a table matching the given identifier.
So if you have a table named [mylogin.tablename] and there is also a table
[public.tablename], if you issue SELECT * FROM tablename, you'll get the
contents of [public.tablename] UNLESS you're logged in as 'mylogin', in
which case you'll get the contents of [mylogin.tablename].

This is IMO a kind of questionable practice, but there are existing uses
like this out there, and making the default schema always explicit breaks
this. Note this is not only a pre-MSSQL2005 issue, I think 2005+ will still
recognize user style schemas.

3) Isn't Micheal's concern below still valid?



 just FTR, the current expected behavior of default schemas is that if
 your tables are known to exist in the default schema configured on the
 database connection, you leave the schema attribute on Table blank.
 otherwise, you set it.

 this is actually a convention that we've had to choose.  if the two
 conventions are mixed, table reflection gets confused over whether to
 look for/place tables with the key tablename or
 schemaname.tablename into the MetaData object.  While we could try
 building an enhanced key object which hashes both tablename and
 schema.tablename as the same key depending on the default schema
 of the DB, this requires a live connection to the database in order to
 function, and as we all know a MetaData can be bound to a DB later
 on...so for now we have the convention.



--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL default_schema

2008-12-23 Thread Empty
Rick,

On Tue, Dec 23, 2008 at 10:32 AM, Rick Morrison rickmorri...@gmail.comwrote:

 I've got a few concerns with the just-committed get_default_schema_name()
 approach:

 1) What about pre-2005 users?  The query used in this patch to fetch the
 schema name won't work. There was not even a real hard concept of 'schema'
 pre-MSSQL-2005.


I looked at that. It looks like how it's constructed it will only affect
users of MSSQL 2005.  MSSQL 2000 and before should get the same behavior
they had previously due to the try / except.

We can also put in a version check if preferable.

Michael




--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] ORM relations...

2008-12-23 Thread justmike2...@gmail.com

Over the last couple days I have been having an issue with relations/
imports.  I have a class called queue where I define all my columns.
Within queue I have a function that references a class filequeue so I
need to 'from filequeues import filequeue'.  The queue class itself
has relations with other classes/tables.  My problem is that within
filequeue, I need to 'from queues import queue' in order to ForeignKey
(queue.queueid).  Well now queue imports filequeue and filequeue
imports queue causing an issue.  I tried to ForeignKey
('QUEUES.queueid') but SQLAlch says it cannot find the tables.

Any ideas?

--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: psycopg2 and Python 2.6

2008-12-23 Thread Michael Bayer

we're good for 2.6 and in particular the 0.5.0 trunk (post rc4)  is  
tested on 2.6, and even runs fairly well with the -3 flag.

On Dec 23, 2008, at 8:04 AM, vctr...@gmail.com wrote:


 Hi all,

 I'm trying to port to python 2.6 with SQLAlchemy over PostgrSQL and it
 seems that all is porting BUT the psycopg2 component?

 Is anyone aware of a working version of psycopg2 for Linx 64 arch?

 In general - does SQLAlchemy support 2.6? I was under the impression
 that it does.

 Is there another DB (not PostgerSQL) that does work?

 Thanks
 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: ORM relations...

2008-12-23 Thread Michael Bayer

ForeignKey accepts strings to remove the inconvenience of handling  
circular imports.   Both dependent tables will need to be present  
within the shared MetaData object at the point at which the Table  
object is first used, though, so another module that imports both  
queue and filequeue would be best.

On Dec 23, 2008, at 10:48 AM, justmike2...@gmail.com wrote:


 Over the last couple days I have been having an issue with relations/
 imports.  I have a class called queue where I define all my columns.
 Within queue I have a function that references a class filequeue so I
 need to 'from filequeues import filequeue'.  The queue class itself
 has relations with other classes/tables.  My problem is that within
 filequeue, I need to 'from queues import queue' in order to ForeignKey
 (queue.queueid).  Well now queue imports filequeue and filequeue
 imports queue causing an issue.  I tried to ForeignKey
 ('QUEUES.queueid') but SQLAlch says it cannot find the tables.

 Any ideas?

 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: ORM relations...

2008-12-23 Thread Michael Mileusnich
I am not sure based on the project if I can have a module that imports both
of them.  How can I use the string based ForeignKey?  I may be doing it in
correctly because it says the table does not exist that I try to reference.

On Tue, Dec 23, 2008 at 12:18 PM, Michael Bayer mike...@zzzcomputing.comwrote:


 ForeignKey accepts strings to remove the inconvenience of handling
 circular imports.   Both dependent tables will need to be present
 within the shared MetaData object at the point at which the Table
 object is first used, though, so another module that imports both
 queue and filequeue would be best.

 On Dec 23, 2008, at 10:48 AM, justmike2...@gmail.com wrote:

 
  Over the last couple days I have been having an issue with relations/
  imports.  I have a class called queue where I define all my columns.
  Within queue I have a function that references a class filequeue so I
  need to 'from filequeues import filequeue'.  The queue class itself
  has relations with other classes/tables.  My problem is that within
  filequeue, I need to 'from queues import queue' in order to ForeignKey
  (queue.queueid).  Well now queue imports filequeue and filequeue
  imports queue causing an issue.  I tried to ForeignKey
  ('QUEUES.queueid') but SQLAlch says it cannot find the tables.
 
  Any ideas?
 
  


 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: ORM relations...

2008-12-23 Thread Michael Bayer
thats because both Table objects need to be present in the MetaData  
when used.   Ultimately your application can't run unless both queue  
and filequeue have been imported in some way.


On Dec 23, 2008, at 1:21 PM, Michael Mileusnich wrote:

 I am not sure based on the project if I can have a module that  
 imports both of them.  How can I use the string based ForeignKey?  I  
 may be doing it in correctly because it says the table does not  
 exist that I try to reference.

 On Tue, Dec 23, 2008 at 12:18 PM, Michael Bayer mike...@zzzcomputing.com 
  wrote:

 ForeignKey accepts strings to remove the inconvenience of handling
 circular imports.   Both dependent tables will need to be present
 within the shared MetaData object at the point at which the Table
 object is first used, though, so another module that imports both
 queue and filequeue would be best.

 On Dec 23, 2008, at 10:48 AM, justmike2...@gmail.com wrote:

 
  Over the last couple days I have been having an issue with  
 relations/
  imports.  I have a class called queue where I define all my columns.
  Within queue I have a function that references a class filequeue  
 so I
  need to 'from filequeues import filequeue'.  The queue class itself
  has relations with other classes/tables.  My problem is that within
  filequeue, I need to 'from queues import queue' in order to  
 ForeignKey
  (queue.queueid).  Well now queue imports filequeue and filequeue
  imports queue causing an issue.  I tried to ForeignKey
  ('QUEUES.queueid') but SQLAlch says it cannot find the tables.
 
  Any ideas?
 
  





 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: ORM relations...

2008-12-23 Thread Michael Mileusnich
I have a py file that creates my tables.  It does MetaData =
queue.metadata.  metadata.create_all().  That's all I do with MetaData.  Is
there additional table setup I need to be doing?

On Tue, Dec 23, 2008 at 12:24 PM, Michael Bayer mike...@zzzcomputing.comwrote:

 thats because both Table objects need to be present in the MetaData when
 used.   Ultimately your application can't run unless both queue and
 filequeue have been imported in some way.


 On Dec 23, 2008, at 1:21 PM, Michael Mileusnich wrote:

 I am not sure based on the project if I can have a module that imports both
 of them.  How can I use the string based ForeignKey?  I may be doing it in
 correctly because it says the table does not exist that I try to reference.

 On Tue, Dec 23, 2008 at 12:18 PM, Michael Bayer 
 mike...@zzzcomputing.comwrote:


 ForeignKey accepts strings to remove the inconvenience of handling
 circular imports.   Both dependent tables will need to be present
 within the shared MetaData object at the point at which the Table
 object is first used, though, so another module that imports both
 queue and filequeue would be best.

 On Dec 23, 2008, at 10:48 AM, justmike2...@gmail.com wrote:

 
  Over the last couple days I have been having an issue with relations/
  imports.  I have a class called queue where I define all my columns.
  Within queue I have a function that references a class filequeue so I
  need to 'from filequeues import filequeue'.  The queue class itself
  has relations with other classes/tables.  My problem is that within
  filequeue, I need to 'from queues import queue' in order to ForeignKey
  (queue.queueid).  Well now queue imports filequeue and filequeue
  imports queue causing an issue.  I tried to ForeignKey
  ('QUEUES.queueid') but SQLAlch says it cannot find the tables.
 
  Any ideas?
 
  









 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: ORM relations...

2008-12-23 Thread Michael Bayer


On Dec 23, 2008, at 1:29 PM, Michael Mileusnich wrote:

 I have a py file that creates my tables.  It does MetaData =  
 queue.metadata.  metadata.create_all().  That's all I do with  
 MetaData.  Is there additional table setup I need to be doing?

yeah have it do import filequeue; import queue;   
queue.metadata.create_all().  or alternatively have queue import  
filequeue as well.



--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL default_schema

2008-12-23 Thread Rick Morrison
 Im curious, is the MSSQL dialect rendering tables as
schemaname.tablename in all cases ?

No, I don't think so: the module uses non-overridden calls to
compiler.IdentifierPreparer.format_table() and format_column().

So then the only usage of the get_default_schema_name() is for table
existence checks, and to fetch schema metadata for table reflection? Then
I'll withdraw my concerns, that's no big deal.

--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL default_schema

2008-12-23 Thread Michael Bayer


On Dec 23, 2008, at 2:15 PM, Rick Morrison wrote:

  Im curious, is the MSSQL dialect rendering tables as  
 schemaname.tablename in all cases ?

 No, I don't think so: the module uses non-overridden calls to  
 compiler.IdentifierPreparer.format_table() and format_column().

 So then the only usage of the get_default_schema_name() is for table  
 existence checks, and to fetch schema metadata for table reflection?  
 Then I'll withdraw my concerns, that's no big deal.

so if we can confirm this ! .socloseto...release



--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL default_schema

2008-12-23 Thread Randall Smith

Michael Bayer wrote:
 
 so if we can confirm this ! .socloseto...release
 


 From grepping:

For the Oracle dialect get_default_schema_name is used in reflecttable, 
has_table and has_sequence. has_table, in turn, is used by the 
SchemaGenerator and SchemaDropper.

MSSQL uses it for reflecttable and has_table and others do the same or less.

Outside of the dialects, get_default_schema_name is used for 
Engine.table_names

-Randall


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: cascade

2008-12-23 Thread Michael Bayer

ondelete and onupdate are keyword arguments within ForeignKey()  
itself, and they come out as part of the DDL when you call  
metadata.create_all().

On Dec 23, 2008, at 8:42 PM, justmike2...@gmail.com wrote:


 I seem to be running into a problem with implementing cascades in
 sqlalch.  Next to my ForeignKey() I have ondelete and onupdate both
 set to CASCADE and in my mapper I have this:

 mapper(queue, queue_table, properties=dict(parent=relation(queue,
 backref='JOBS')))

 However the cascade is not being listed in MSSQL.
 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL default_schema

2008-12-23 Thread Lukasz Szybalski

On Tue, Dec 23, 2008 at 3:34 PM, Randall Smith rand...@tnr.cc wrote:

 Michael Bayer wrote:

 so if we can confirm this ! .socloseto...release



  From grepping:

 For the Oracle dialect get_default_schema_name is used in reflecttable,
 has_table and has_sequence. has_table, in turn, is used by the
 SchemaGenerator and SchemaDropper.

 MSSQL uses it for reflecttable and has_table and others do the same or less.

 Outside of the dialects, get_default_schema_name is used for
 Engine.table_names


If you guys tell me how, I could run the unit test for sqlalchemy on
2005, and 2000 sql server.

Lucas

--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: cascade

2008-12-23 Thread Michael Mileusnich
Yea I do the ondelete and onupdate in ForeignKey, creates tables and all but
does not do the cascade or at least not in MSSQL.

On Tue, Dec 23, 2008 at 7:42 PM, justmike2...@gmail.com 
justmike2...@gmail.com wrote:


 I seem to be running into a problem with implementing cascades in
 sqlalch.  Next to my ForeignKey() I have ondelete and onupdate both
 set to CASCADE and in my mapper I have this:

 mapper(queue, queue_table, properties=dict(parent=relation(queue,
 backref='JOBS')))

 However the cascade is not being listed in MSSQL.
 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: cascade

2008-12-23 Thread Michael Bayer
generates the ON DELETE CASCADE in the DDL, versus the cascade does  
not work, are two different issues.   Which are you experiencing, and  
if the latter, how is the issue manifesting itself ?  Can you produce  
sample code which reproduces your issue ?



On Dec 23, 2008, at 10:19 PM, Michael Mileusnich wrote:

 Yea I do the ondelete and onupdate in ForeignKey, creates tables and  
 all but does not do the cascade or at least not in MSSQL.

 On Tue, Dec 23, 2008 at 7:42 PM, justmike2...@gmail.com 
 justmike2...@gmail.com 
  wrote:

 I seem to be running into a problem with implementing cascades in
 sqlalch.  Next to my ForeignKey() I have ondelete and onupdate both
 set to CASCADE and in my mapper I have this:

 mapper(queue, queue_table, properties=dict(parent=relation(queue,
 backref='JOBS')))

 However the cascade is not being listed in MSSQL.



 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: cascade

2008-12-23 Thread Michael Mileusnich
code:
queue_table = Table(
'QUEUES', metadata,
Column('QUEUEID', Integer, autoincrement=True, primary_key=True),
Column('JOBNUM', String(48), ForeignKey('JOBS.JOBNUM',
onupdate=CASCADE, ondelete=CASCADE)),
Column('SCHEDID', String(48), ForeignKey('SCHEDULES.SCHEDID')),
Column('DATE', DateTime),
Column('STATUS', Integer)) # 0 sched 1 Ignore 2 Evalling 3 Running 4
Unsched 5 Error

mapper(queue, queue_table, properties=dict(parent=relation(queue,
backref='job')))

In MSSQL the cascade entries for those tables are set to none and my app
also generate this:

many-to-many relation, 'secondaryjoin' is needed as well. % (self))
sqlalchemy.exc.ArgumentError: Could not determine join condition between
parent/
child tables on relation queue.parent.  Specify a 'primaryjoin' expression.
If
this is a many-to-many relation, 'secondaryjoin' is needed as well.

On Tue, Dec 23, 2008 at 10:52 PM, Michael Bayer mike...@zzzcomputing.comwrote:

 generates the ON DELETE CASCADE in the DDL, versus the cascade does not
 work, are two different issues.   Which are you experiencing, and if the
 latter, how is the issue manifesting itself ?  Can you produce sample code
 which reproduces your issue ?



 On Dec 23, 2008, at 10:19 PM, Michael Mileusnich wrote:

 Yea I do the ondelete and onupdate in ForeignKey, creates tables and all
 but does not do the cascade or at least not in MSSQL.

 On Tue, Dec 23, 2008 at 7:42 PM, justmike2...@gmail.com 
 justmike2...@gmail.com wrote:


 I seem to be running into a problem with implementing cascades in
 sqlalch.  Next to my ForeignKey() I have ondelete and onupdate both
 set to CASCADE and in my mapper I have this:

 mapper(queue, queue_table, properties=dict(parent=relation(queue,
 backref='JOBS')))

 However the cascade is not being listed in MSSQL.







 


--~--~-~--~~~---~--~~
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 email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---