[sqlalchemy] how to use model.py file across different applications

2009-01-20 Thread abhishek
Hello all, I have been using SQL Alchemy for sometime now in a turbo gears project. Recently, i wanted to write a small piece of python code which has to do a few DB operations on the same DB which is used by my TG project. so i decided to use the existing model.py file. to my delight, as soon

[sqlalchemy] Re: how to use model.py file across different applications

2009-01-20 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of abhishek Sent: 20 January 2009 14:26 To: sqlalchemy Subject: [sqlalchemy] how to use model.py file across different applications Hello all, I have been using SQL Alchemy

[sqlalchemy] Re: Loading JPG images into an Oracle Long Raw field

2009-01-20 Thread Gregg Parks
Michael, I read the expression language tutorial and found the section on bindparam. So, here's what I came up with: idworks = Table( 'ps_ih_idworks', metadata, Column('emplid', String(11), primary_key=True), Column('date_acquired', Date),

[sqlalchemy] Re: Loading JPG images into an Oracle Long Raw field

2009-01-20 Thread Michael Bayer
RAW columns have a max of 2000 bytes (http://www.orafaq.com/wiki/ RAW ). you want to create your table with a BLOB column for more than that. On Jan 20, 2009, at 11:12 AM, Gregg Parks wrote: Michael, I read the expression language tutorial and found the section on bindparam. So,

[sqlalchemy] Re: Saving the results of a sqlalchemy join using Python

2009-01-20 Thread Boudewijn Ector
On Tue, Jan 20, 2009 at 8:24 AM, a...@svilendobrev.com wrote: mmh, cant really grasp what u want to do. what are Line.* attributes? .filter does and(), so this can be simplified: q = query(Line).filter( models.Line.LineDiscarded == LineDiscarded ) if ...: return q.filter( sites...)

[sqlalchemy] unsubscribe

2009-01-20 Thread Doug Farrell
unsubscribe --~--~-~--~~~---~--~~ 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] Fetching a mapped object using only its id

2009-01-20 Thread Georg Schmid
I'm trying to build up the model I need in my current project, but I'm also having a few issues with implementing properties of the following kind. I want to add a property to one of my mappers. This property is supposed to refer to a different object, only given the id (primary key of the table,

[sqlalchemy] Re: Fetching a mapped object using only its id

2009-01-20 Thread Michael Bayer
On Jan 20, 2009, at 11:34 AM, Georg Schmid wrote: I'm trying to build up the model I need in my current project, but I'm also having a few issues with implementing properties of the following kind. I want to add a property to one of my mappers. This property is supposed to refer to a

[sqlalchemy] Re: Saving the results of a sqlalchemy join using Python

2009-01-20 Thread az
which join are u mentioning? and which result u want to save? the query itself or the objects it returns after execution? q = query(Line).join( Fiber, ...condition ).filter() if ... return q.filter( 123...) else: return q.filter( 456...) building that q is not expensive; saving it is fine

[sqlalchemy] Re: Loading JPG images into an Oracle Long Raw field

2009-01-20 Thread Gregg Parks
My apologies - I forgot to mention the photo field is a LONG RAW and that the table already exists. In the table definition the field is now defined as Column ('employee_photo', OracleRaw(10)) and code that is trying to write to the table is: u =

[sqlalchemy] Re: how to use model.py file across different applications

2009-01-20 Thread abhishek
Thanks simon. On Jan 20, 8:37 pm, King Simon-NFHD78 simon.k...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of abhishek Sent: 20 January 2009 14:26 To: sqlalchemy Subject: [sqlalchemy] how to use

[sqlalchemy] Re: Fetching a mapped object using only its id

2009-01-20 Thread Georg Schmid
On Jan 20, 5:45 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 20, 2009, at 11:34 AM, Georg Schmid wrote: I'm trying to build up the model I need in my current project, but I'm also having a few issues with implementing properties of the following kind. I want to add a

[sqlalchemy] Re: Loading JPG images into an Oracle Long Raw field

2009-01-20 Thread Michael Bayer
first, try this patch: Index: lib/sqlalchemy/databases/oracle.py === --- lib/sqlalchemy/databases/oracle.py (revision 5695) +++ lib/sqlalchemy/databases/oracle.py (working copy) @@ -258,9 +258,19 @@ return process

[sqlalchemy] Re: Fetching a mapped object using only its id

2009-01-20 Thread Michael Bayer
On Jan 20, 2009, at 12:55 PM, Georg Schmid wrote: On a side note, could you give me a hint on what's the difference between deferred and lazy loading? I suspect it's exactly the same thing, except one for columns only and the other one for relation()s. that's the difference, yup. the

[sqlalchemy] does tometadata have to change foreign key schema name if it already specified?

2009-01-20 Thread sector119
Hi ALL! Does tometadata have to change foreign key schema name if it already specified? For example if I have column 'user_id' with 'system.users.id' FK - tometadata change 'system' schema to SOME_SCHEMA. Is it ok, or tometadata have to set schema to SOME_SCHEMA for street_id, locality_id

[sqlalchemy] MSSQL Reflection Error

2009-01-20 Thread Greg
I've got the following code to reflect an MS SQL 8 database using the latest stable pyodbc, python 2.5, and SQLAlchemy 5.1: engine = create_engine('mssql://userXXX:pass...@mydsn', echo=False) meta = MetaData() meta.bind = engine artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Michael Bayer
send along what the CREATE TABLE for the table in question looks like. On Jan 20, 2009, at 4:20 PM, Greg wrote: I've got the following code to reflect an MS SQL 8 database using the latest stable pyodbc, python 2.5, and SQLAlchemy 5.1: engine =

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Greg
If I understand, i only need to do that when I want to create a table. I'm just trying to introspect an existing production database, not create any new tables. On Jan 20, 4:37 pm, Michael Bayer mike...@zzzcomputing.com wrote: send along what the CREATE TABLE for the table in question looks

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Rick Morrison
I'm just trying to introspect an existing production database, not create any new tables. The structure of the table is read when reflecting the table: it's likely that an unusual column definition would trigger an error like this, and it would be helpful to someone diagnosing the problem to

[sqlalchemy] passing tuple argument into sqlalchemy.sql.text string

2009-01-20 Thread Faheem Mitha
Hi, I've got a query as follows: from sqlalchemy.sql import text gq = text( SELECT decode_genotype(cell.snpval_id, snp.allelea_id, snp.alleleb_id) FROM cell JOIN snp ON snp.fid = cell.snp_id WHERE cell.patient_chipid IN ('DUKE1_plateA_A10.CEL', 'DUKE1_plateA_A11.CEL') ) I want

[sqlalchemy] Re: does tometadata have to change foreign key schema name if it already specified?

2009-01-20 Thread Michael Bayer
this can be changed but the function still makes no sense. What if you also said t3 = users.tometadata(metadata, schema='SOME_SCHEMA') ? then you would want the system.users.id FK to be changed.the tometadata() approach doesn't provide an API that can take the use case of

[sqlalchemy] Re: cascades and many-to-many

2009-01-20 Thread Michael Bayer
On Jan 19, 2009, at 7:08 PM, Michael Bayer wrote: relation, or add a flag such as single_parent=True, something like that, since technically we should be doing something similar for manytoone as well. OK, single_parent=True is added to the trunk along with a bunch of new tests. Try it

[sqlalchemy] Re: cascades and many-to-many

2009-01-20 Thread Jon Nelson
On Tue, Jan 20, 2009 at 4:26 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 19, 2009, at 7:08 PM, Michael Bayer wrote: relation, or add a flag such as single_parent=True, something like that, since technically we should be doing something similar for manytoone as well. OK,

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Greg
How do I go about doing this? Showing the create table? On Jan 20, 4:54 pm, Rick Morrison rickmorri...@gmail.com wrote: I'm just trying to introspect an existing production database, not create any new tables. The structure of the table is read when reflecting the table: it's likely that

[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Michael Bayer
yeah i meant send along the CREATE TABLE to the mailing list here. or a describe, whatever shows us what column type might be failing. On Jan 20, 2009, at 9:45 PM, Greg wrote: How do I go about doing this? Showing the create table? On Jan 20, 4:54 pm, Rick Morrison