[sqlalchemy] Re: database definitions - was sqlalchemy migration/schema creation

2008-05-15 Thread az
they said in Soft Wars: read the source, Luke... u want everything premade? it's what it says. no mysql in there. i've no idea about mysql. just add it - poke here and there - and once it works for you, post it here. i'll check it in... On Thursday 15 May 2008 07:08:59 Lukasz Szybalski wrote:

[sqlalchemy] Re: Pre-commit hooks

2008-05-15 Thread Yannick Gingras
Michael Bayer [EMAIL PROTECTED] writes: easy enough to build yourself a generic MapperExtension that scans incoming objects for a _pre_commit() method. Yeah indeed. I used this: -- class HookExtension(MapperExtension): Extention to add pre-commit hooks.

[sqlalchemy] Re: Pre-commit hooks

2008-05-15 Thread Roger Demetrescu
On 5/15/08, Yannick Gingras [EMAIL PROTECTED] wrote: Michael Bayer [EMAIL PROTECTED] writes: easy enough to build yourself a generic MapperExtension that scans incoming objects for a _pre_commit() method. Yeah indeed. I used this: -- class

[sqlalchemy] Re: Pre-commit hooks

2008-05-15 Thread az
speed wise, this is better: hasattr is implemented as getattr + try except. i would do it even: f = getattr(instance, _pre_insert, None) if f: f() Thus the func name is spelled only once - avoids stupid mistakes. On Thursday 15 May 2008 17:36:52 Roger Demetrescu wrote: On 5/15/08, Yannick

[sqlalchemy] Re: Pre-commit hooks

2008-05-15 Thread Roger Demetrescu
On 5/15/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: speed wise, this is better: hasattr is implemented as getattr + try except. i would do it even: f = getattr(instance, _pre_insert, None) if f: f() Thus the func name is spelled only once - avoids stupid mistakes. Good point...

[sqlalchemy] Re: Pre-commit hooks

2008-05-15 Thread Yannick Gingras
[EMAIL PROTECTED] writes: speed wise, this is better: hasattr is implemented as getattr + try except. i would do it even: f = getattr(instance, _pre_insert, None) if f: f() Thus the func name is spelled only once - avoids stupid mistakes. Spelling only once is the killer feature of

[sqlalchemy] Challenging relationship: many-to-many, custom join, mapped dictionary, can it work???

2008-05-15 Thread Allen Bierbaum
I am trying to setup a many-to-many relationship for two tables where I would like to allow more natural access to the data using a dictionary interface. The exact usage is pretty complex to explain, but I have come up with a simple example that demonstrates the same concept. (there is a full

[sqlalchemy] Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
I'm trying to implement polymorphic inheritance using the sqlalchemy.ext.declarative, but the field that I want to use for the polymorphic_on is not in my polymorphic base table, but at the other end of a many-to-one relationship. We have items of many types, and in the item table, we have a

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
On Thu, 2008-05-15 at 11:24 -0400, J. Cliff Dyer wrote: I'm trying to implement polymorphic inheritance using the sqlalchemy.ext.declarative, but the field that I want to use for the polymorphic_on is not in my polymorphic base table, but at the other end of a many-to-one relationship. We

[sqlalchemy] Re: SQLAlchemy 0.4.6 released

2008-05-15 Thread Bobby Impollonia
Any idea when a .deb will be available? http://packages.debian.org/unstable/python/python-sqlalchemy is still .4.5 On Wed, May 14, 2008 at 3:02 PM, Michael Bayer [EMAIL PROTECTED] wrote: SQLAlchemy 0.4.6 is now available at: http://www.sqlalchemy.org/download.html This release includes

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
On Thu, 2008-05-15 at 11:30 -0400, J. Cliff Dyer wrote: On Thu, 2008-05-15 at 11:24 -0400, J. Cliff Dyer wrote: I'm trying to implement polymorphic inheritance using the sqlalchemy.ext.declarative, but the field that I want to use for the polymorphic_on is not in my polymorphic base table,

[sqlalchemy] Connecting to an MS SQL server ?

2008-05-15 Thread TkNeo
Hi, This is my first encounter with sqlalchemy. I am trying to connect to an MS SQL server 2000 that is not on local host. I want to connect using Integrated Security and not use a specific username and password. Can anyone tell me the format of the connection string ? Thanks TK

[sqlalchemy] Re: How to specify NOLOCK queries in SA (mssql)

2008-05-15 Thread Rick Morrison
Hi Bruce, I'm considering a switch from pymssql to pyodbc myself in the not-too-distance future, and this thread has me a bit curious about what's going on. This is a subject that may affect SQL more in the future when ODBC and JDBC drivers get more use. I think there's two distinct questions

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread Michael Bayer
On May 15, 2008, at 12:12 PM, J. Cliff Dyer wrote: How can I use this field for polymorphism? Is it possible? polymorphic discriminators are currently table-local scalar columns. So if you had a many-to-one of discriminators, youd currently have to encode the discriminator to the

[sqlalchemy] Re: Challenging relationship: many-to-many, custom join, mapped dictionary, can it work???

2008-05-15 Thread Michael Bayer
On May 15, 2008, at 11:23 AM, Allen Bierbaum wrote: # WOULD LIKE - # # Can this be done using # - Custom join condition on input_output_type # - column_mapped_collection # it can be done. Try working first with two separate relation()s using a secondary join that filters

[sqlalchemy] Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
Hello Group, After looking over the 0.5 migration notes and seeing that implicit ordering is to be removed, it seems to me that it might make sense to change the default collection class for unordered relations from a list to a multiset. This would reinforce that unless order_by is specified,

[sqlalchemy] processing.Process and sqlalchemy

2008-05-15 Thread Craig Swank
Hello, I am playing around with loading data into a database using subclasses of processing.Process so that data files can be sent to a server. I would like to have the server fire off a process that takes care of parsing the data file and loading the data into a data. When I run some tests

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread az
After looking over the 0.5 migration notes and seeing that implicit ordering is to be removed, it seems to me that it might make sense to change the default collection class for unordered relations from a list to a multiset. This would reinforce that unless order_by is specified, one

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
mmh. between db's - maybe u're right. But the order will also change depending on current hash-values between 2 runs on otherwise same system... There's plenty of difficulties to get a repeatable flow for tests etc already. That's exactly my point in fact -- unless order_by is specified, a

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Michael Bayer
On May 15, 2008, at 12:51 PM, Nick Murphy wrote: Hello Group, After looking over the 0.5 migration notes and seeing that implicit ordering is to be removed, it seems to me that it might make sense to change the default collection class for unordered relations from a list to a multiset.

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
if we had a totally explicit collection class is required approach, that would be something different (like, cant use list as a collection unless order_by is present). We might just say in any case that order_by is required with listbut then that might be too steep a change for 0.4 to

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread jason kirtland
Nick Murphy wrote: mmh. between db's - maybe u're right. But the order will also change depending on current hash-values between 2 runs on otherwise same system... There's plenty of difficulties to get a repeatable flow for tests etc already. That's exactly my point in fact -- unless

[sqlalchemy] Re: Connecting to an MS SQL server ?

2008-05-15 Thread Yannick Gingras
TkNeo [EMAIL PROTECTED] writes: Hi, Hello Tarun, This is my first encounter with sqlalchemy. I am trying to connect to an MS SQL server 2000 that is not on local host. I want to connect using Integrated Security and not use a specific username and password. Can anyone tell me the format

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Rick Morrison
I think Jason hits the nail on the head with his response - my first reaction on the initial post was that was splitting hairs to enforce the difference between an ordered list and an (allegedly) unordered list, but I thought it was going to be a non-starter until I read Mike's reply. It seems

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Michael Bayer
it should be considered that when you use hibernate, the collection type is explicit with the collection mapping itself; and when you use the list type, a list-index is required (which is also a much better name here than order_by). So there is the notion that using a list should at all

[sqlalchemy] Re: Connecting to an MS SQL server ?

2008-05-15 Thread Rick Morrison
The DSN method should work with Integrated Security as well. Here's a short writeup of the DSN configuration: http://support.microsoft.com/kb/176378 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Re: Polymorphic across foreign key

2008-05-15 Thread J. Cliff Dyer
On Thu, 2008-05-15 at 12:27 -0400, Michael Bayer wrote: On May 15, 2008, at 12:12 PM, J. Cliff Dyer wrote: How can I use this field for polymorphism? Is it possible? polymorphic discriminators are currently table-local scalar columns. So if you had a many-to-one of

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread Nick Murphy
Logic that depends on any ordering from a non-ORDER BY result is a bug, but I don't know that the impact of presenting all users with a new, non-standard, non-native collection type and injecting some kind of __eq__ into mapped classes to satisfy a multiset contract is worth it for what

[sqlalchemy] Re: Default collection class for unordered relations

2008-05-15 Thread jason kirtland
Nick Murphy wrote: Logic that depends on any ordering from a non-ORDER BY result is a bug, but I don't know that the impact of presenting all users with a new, non-standard, non-native collection type and injecting some kind of __eq__ into mapped classes to satisfy a multiset contract is

[sqlalchemy] allow_column_override

2008-05-15 Thread Chris Guin
My goal is to have a one-to-many relation defined using the same name as the foreign key column underneath. So that, if my Detection table has a foreignkey column named sensor, the following mappers should work, I think: mapper(Sensor, sensor) detectionmapper = mapper(Detection, detection,

[sqlalchemy] SA with ORACLE connect

2008-05-15 Thread sbhatt
Hi All, I want to write a query in SA which uses ORACLE 'connect' along with joins on other table. The query will be:- SELECT grouprelation.grouprelationid AS grouprelation_grouprelationid, grouprelation.parentgroupid AS grouprelation_parentgroupid, grouprelation.childgroupid AS

[sqlalchemy] Re: Challenging relationship: many-to-many, custom join, mapped dictionary, can it work???

2008-05-15 Thread Allen Bierbaum
On Thu, May 15, 2008 at 11:37 AM, Michael Bayer [EMAIL PROTECTED] wrote: On May 15, 2008, at 11:23 AM, Allen Bierbaum wrote: # WOULD LIKE - # # Can this be done using # - Custom join condition on input_output_type # - column_mapped_collection # it can be done. Try working

[sqlalchemy] Re: allow_column_override

2008-05-15 Thread Michael Bayer
On May 15, 2008, at 3:23 PM, Chris Guin wrote: My goal is to have a one-to-many relation defined using the same name as the foreign key column underneath. So that, if my Detection table has a foreignkey column named sensor, the following mappers should work, I think:

[sqlalchemy] Re: Challenging relationship: many-to-many, custom join, mapped dictionary, can it work???

2008-05-15 Thread Michael Bayer
On May 15, 2008, at 3:54 PM, Allen Bierbaum wrote: The thing that I am missing though is an example of using column_mapped_collection with a many-to-many relationship. Maybe I am just a bit slow, but I can't wrap my head around how to make that work or more specifically, how to specify it.

[sqlalchemy] Re: SA with ORACLE connect

2008-05-15 Thread Michael Bayer
On May 15, 2008, at 3:53 PM, sbhatt wrote: Does anyone know how to write it using SA ? CONNECT BY goes where things like ORDER BY and GROUP BY go, so is not going to work within the WHERE clause. It is as of yet unsupported by the select() construct so you'd have to go with

[sqlalchemy] Re: Connecting to an MS SQL server ?

2008-05-15 Thread TkNeo
I don't want to use the DSN method. The DSN would not be configured at some client machines etc etc. .. TK On May 15, 1:30 pm, Rick Morrison [EMAIL PROTECTED] wrote: The DSN method should work with Integrated Security as well. Here's a short writeup of the DSN configuration:

[sqlalchemy] Re: Connecting to an MS SQL server ?

2008-05-15 Thread Rick Morrison
You really should reconsider. DSN is a much easier setup method than trying to specify a myriad of ODBC options in a connection string. There's a GUI user interface for setting up DSN's etc. It's the simpler and better supported method. If you really are dead-set against it, you'll need to use

[sqlalchemy] Re: Connecting to an MS SQL server ?

2008-05-15 Thread Olivier Thiery
The following works for me : mssql://:@host/catalog It seems to use automatically SSPI auth if you don't specify any user and password. Olivier 2008/5/15, TkNeo [EMAIL PROTECTED]: I don't want to use the DSN method. The DSN would not be configured at some client machines etc etc. .. TK

[sqlalchemy] declarative_base and UNIQUE Constraint

2008-05-15 Thread Carlos Hanson
Greetings, I just started playing with declarative_base. I have one table on which I would like to have a unique contraint on two columns. Is this possible using declarative? -- Carlos Hanson --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Re: declarative_base and UNIQUE Constraint

2008-05-15 Thread Carlos Hanson
On Thu, May 15, 2008 at 3:43 PM, Carlos Hanson [EMAIL PROTECTED] wrote: Greetings, I just started playing with declarative_base. I have one table on which I would like to have a unique contraint on two columns. Is this possible using declarative? -- Carlos Hanson I think there are two

[sqlalchemy] Re: Connecting to an MS SQL server ?

2008-05-15 Thread Lukasz Szybalski
On Thu, May 15, 2008 at 12:51 PM, Yannick Gingras [EMAIL PROTECTED] wrote: TkNeo [EMAIL PROTECTED] writes: Hi, Hello Tarun, This is my first encounter with sqlalchemy. I am trying to connect to an MS SQL server 2000 that is not on local host. I want to connect using Integrated Security