[sqlalchemy] Re: Firebird - column types

2007-10-12 Thread Roger Demetrescu

Werner,

On 10/4/07, Werner F. Bruhin [EMAIL PROTECTED] wrote:

 Scanning firebird.py I noticed that:

  FBText returns BLOB SUB_TYPE 2

 Shouldn't that be BLOB SUB_TYPE 1 or BLOB SUB_TYPE TEXT

 and FBBinary returns BLOB SUB_TYPE 1

 Shouldn't that be BLOB SUB_TYPE 0

 See Helen's FB Book on page 182 and/or page 78 of the IB 6 Data
 Definition Guide (DataDef.pdf).

You are right... it is fixed in [3589].

Thanks,

Roger

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Christophe de VIENNE

2007/10/12, John M Camara [EMAIL PROTECTED]:

  I performed a release under LGPL. Hope that this is ok and fits into
  the sqlalchemy environment.
 

 Why not just release it under MIT like SQLAlchemy?  The project will
 likely receive wider use under MIT rather than LGPL.

+1 on the MIT licence

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Gaetan de Menten

I couldn't agree more. I mean: shouldn't the autoload part be
integrated into SQLAlchemy reflection capability if it can do more
than SQLAlchemy 0.4 currently support (or simply removed if it doesn't
do more)?

And I fact, I think the formatting part could also be integrated into
SQLALchemy proper (in the repr methods of the corresponding objects).
The whole autocode project could just boil down do a few-lines script
(mainly to take command line options and act accordingly).

Ok, this is just my 2c, but I hate to see duplication of work :)



On 10/11/07, Paul Johnston [EMAIL PROTECTED] wrote:
 Hi,

 It's really good to see this script progressing.

 BTW, with SA 0.4, this script should be able to work with no
 database-specific hacks at all. If you're interesting in implementing this,
 I can explain more.

 Paul

-- 
Gaëtan de Menten
http://openhex.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Paul Johnston

Hi,

I don't say that everything should be integrated, just the reflection
part (if at all useful in SA0.4) and the repr methods of the
corresponding objects (*_repr in formatter.py) which should IMHO
replace the current repr methods. 

That sounds good. One consideration is that autocode repr functions 
include line breaks and indentation, so the resulting code is easier to 
read. I hope this isn't too verbose for default repr functions. If it is 
we could make the behaviour switchable with a parameter.

With this functionality in SA, autocode becomes somewhat shorter. I 
wonder if we could have a scripts directory in the main SA svn, where 
this could live? It would be good to have an admin script too (create 
tables, see status of database against SA definitions, etc).

Paul

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Many-to-many back to single table

2007-10-12 Thread Sean Davis
I have two tables:

create table a (
id serial primary key,
name varchar(255) unique
);

create table b (
id serial primary key,
subject int references a(id),
object int references b(id),
otherinfo varchar(255)
);

I have been trying to pull ideas together from the self-referential portion
of the manual and the many-to-many mapping section, and I haven't figured
out how to go about coding this association table and referencing from table
a to get subjects and objects of a given member of a.  Is this possible to
do?

Thanks,
Sean

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Many-to-many back to single table

2007-10-12 Thread Michael Bayer


On Oct 12, 2007, at 2:21 PM, Sean Davis wrote:

 I have two tables:

 create table a (
 id serial primary key,
 name varchar(255) unique
 );

 create table b (
 id serial primary key,
 subject int references a(id),
 object int references b(id),
 otherinfo varchar(255)
 );

 I have been trying to pull ideas together from the self-referential  
 portion of the manual and the many-to-many mapping section, and I  
 haven't figured out how to go about coding this association table  
 and referencing from table a to get subjects and objects of a given  
 member of a.  Is this possible to do?


sure..just set b as the secondary table and set up the  
primaryjoin/secondaryjoin conditions on the relation().


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Basic Level 1 sqlalchemist

2007-10-12 Thread Michael Bayer
you might want to look into Elixir since its the current version of  
ActiveMapper, and is much better documented.  http://elixir.ematia.de/ 
trac/wiki


On Oct 10, 2007, at 2:24 PM, Wes Duff wrote:

 Hello gentelmen and ladies,

 I am very new to sqlalchemy and put in a position where I had to  
 jump out of and airplane and land on my head and walk on my hands  
 to the end of this project.

 I wanted to know how one_to_man and many_to_many are carried out.

 Here is an example

 class Document(ActiveMapper):
 class mapping:
 __table__= 'document'
 id = column(Integer, primary_key=True)
 title = column(Unicode)
 shortdesc_dc = column(Unicode, nullable=True)

 doc_type_id = column(Integer, foreign_key=ForeignKey 
 ('doc_type.id'))
 layout_id = column(Integer, foreign_key=ForeignKey 
 ('layout.id'))
 body_id = column(Integer, foreign_key=ForeignKey(' body.id'))

 dochists = one_to_many('DocumentHistory', colname='doc_id',  
 backref='document')
 doctags = many_to_many('DocTag', document_doc_tag_table,  
 backref='document')



 Does this mean that there is one document to many DocumentHistory.  
 If so that is what I need

 And below is the DocumentHistory section


 class DocumentHistory(ActiveMapper):
 class mapping:
 __table__= 'document_hist'
 id = column(Integer, primary_key=True)
 user_guid = column(Integer, nullable=True)
 timestamp = column(TIMESTAMP, nullable=False)
 rev_num = column(Integer, nullable=True)
 change = column(Unicode, nullable=True)

 doc_id = column(CHAR(32), foreign_key=ForeignKey('  
 document.id'))


 Thanks for your help. Some day I will repay the group with my  
 knowlege.

 Wes Duff

 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Simon Pamies



On Oct 11, 11:10 am, Werner F. Bruhin [EMAIL PROTECTED] wrote:

 I had changed one of the other versions to handle Firebird and got it to
 work for my purposes, but did some hacks which were not for public
 consumption.

 If you or someone else can help me working the hacks out then maybe
 Firebird could be supported by this new autocode.

Will try to include this using your help - more via private mail.

 I did the test with sqlalchemy 0.4beta6, which seems to require some
 changes to autocode.

Thanks a lot for the information. I will try to include this in the
0.5 line.

Simon


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Simon Pamies



On Oct 12, 10:09 am, Gaetan de Menten [EMAIL PROTECTED] wrote:
 I couldn't agree more. I mean: shouldn't the autoload part be
 integrated into SQLAlchemy reflection capability if it can do more
 than SQLAlchemy 0.4 currently support (or simply removed if it doesn't
 do more)?

As i mentioned in my last reply I'll try to add support for sqlalchemy
0.4 in a 0.5 branch of autocode but will maintain an actively
supported 0.4.x branch.

I don't know how much of the features of autocode should really go
into sqlalchemy. Model generation tools should IMHO always stay a
separate part but I'm open for suggestions. I also hate code
duplication but I think that especially the formatter part should stay
outside of sqlalchemy: It has a strong relation to the autogeneration
of the model and as I've learned from my experience with other ORM
tools, such a feature is better to handle outside the main engine.

My plans:
+ Release a 0.4.1 with more stable formatting engine and a stable
interface with support for all databases where sqlalchemy 0.3.10 has
dialects for.
+ Start working on 0.5 with sqlalchemy 0.4 support
+ Include Firebird support

Everyone who is interested may join the project on googlecode and
contribute source code.

Simon

 On 10/11/07, Paul Johnston [EMAIL PROTECTED] wrote:

  Hi,

  It's really good to see this script progressing.

  BTW, with SA 0.4, this script should be able to work with no
  database-specific hacks at all. If you're interesting in implementing this,
  I can explain more.

  Paul

 --
 Gaëtan de Mentenhttp://openhex.org


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Christophe de VIENNE

2007/10/12, Simon Pamies [EMAIL PROTECTED]:
 On Oct 12, 2:48 am, John M Camara [EMAIL PROTECTED] wrote:
   I performed a release under LGPL. Hope that this is ok and fits into
   the sqlalchemy environment.
 
  Why not just release it under MIT like SQLAlchemy?  The project will
  likely receive wider use under MIT rather than LGPL.

 Can you give me a short explanation of the MIT license model?

Wikipedia is clearer than I would be :
http://en.wikipedia.org/wiki/MIT_License

Christophe

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Simon Pamies



On Oct 11, 2:21 pm, Paul Johnston [EMAIL PROTECTED] wrote:
 BTW, with SA 0.4, this script should be able to work with no
 database-specific hacks at all. If you're interesting in implementing this,
 I can explain more.

Would be nice to hear more details about this.

Currently I'm stuck to 0.3.10 for my projects and so I will support
0.3.10 with the 0.4.x line of autocode.
I will open a branch for the 0.5 version that will have sqlalchemy
0.4.x support.

That does not mean that I will not work on the 0.5 branch it does mean
that I will more actively support 0.4.x but patches and ideas for 0.5
are welcome! If all goes well 0.5 can be released with the first
stable version of sqlalchemy 0.4.

Simon


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] bad query generated

2007-10-12 Thread Julien

Hello,

I have a problem with one of my queries and SQLAlchemy 0.3.10. I try to
translate http://rafb.net/p/hJik4V26.html in SQLAlchemy. The result is
http://rafb.net/p/IieKUW41.html which is almost OK, except that the
final FROM clauses isn't at the good place, SQLAlchemy outputs this :
http://rafb.net/p/31YOgQ49.html which result in a ERROR:  subquery in
FROM may not refer to other relations of same query level error message
in PostgreSQL.

any idea what I did wrong ?

thanks,

Julien


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Paul Johnston

Hi,

BTW, with SA 0.4, this script should be able to work with no
database-specific hacks at all. If you're interesting in implementing this,
I can explain more.


Would be nice to hear more details about this.
  

With 0.4, dialects have a table_names() method that will do the job of 
loader.py.

Some versions of AutoCode (although not 0.4 by the look of it) have 
outputted generic types, rather than db-specific ones, e.g. Integer 
rather than MSInteger. This can be done in a database independent way, 
by going through the __mro__ of the specific type, until a type that 
appears in types.py is encountered.

Paul

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: one-to-one/many-to-one

2007-10-12 Thread Michael Bayer


On Oct 12, 2007, at 2:46 PM, jon wrote:


 Hi,

 I have the following set up in a Pylons application:

 project_table = Table(PROJECT, metadata, autoload=True,
   autoload_with=config['pylons.g'].sa_engine)

 studio_table = Table(STUDIO, metadata, autoload=True,
  autoload_with=config['pylons.g'].sa_engine)

 class Project(object):
 pass

 class Studio(object):
 pass

 mapper(Project, project_table, properties = {'studio' :
 relation(Studio)})

 mapper(Studio, studio_table)

 I'm using an Oracle database and the PROJECT table has a foreign key
 to STUDIO. But when I go to grab a Project object I get this error:

 sqlalchemy.exceptions.ArgumentError: Error determining primary and/or
 secondary join for relationship 'Project.studio (Studio)'. If the
 underlying error cannot be corrected, you should specify the
 'primaryjoin' (and 'secondaryjoin', if there is an association table
 present) keyword arguments to the relation() function (or for
 backrefs, by specifying the backref using the backref() function with
 keyword arguments) to explicitly specify the join conditions. Nested
 error is Can't find any foreign key relationships between 'PROJECT'
 and 'STUDIO'

 I'm following the SQL Alchemy docs 0.4beta6 and the syntax seems to be
 correct. Do I need primaryjoin? Help a noobie out ;-)


it means that PROJECT and STUDIO have no foreign key relationship  
between them, so sqlalchemy cannot guess how to join those two tables.

one thing I would do is, use project and studio as the table  
names (i.e. no uppercase), this indicates non-case sensitive  
reflection.  if still the same error, either spell out the Column  
objects in each Table explicitly (with the correct ForeignKey), or  
use the primaryjoin argument on your relation().

hope this helps.

- mike







--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: FYI: AutoCode moved to a new repository

2007-10-12 Thread Simon Pamies



On Oct 12, 2:48 am, John M Camara [EMAIL PROTECTED] wrote:
  I performed a release under LGPL. Hope that this is ok and fits into
  the sqlalchemy environment.

 Why not just release it under MIT like SQLAlchemy?  The project will
 likely receive wider use under MIT rather than LGPL.

Can you give me a short explanation of the MIT license model?

Simon


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Profiling code to understand memory utilisation

2007-10-12 Thread Arun Kumar PG
I want profile my code to understand the amount of memory SA ORM uses during
a handling a request. Does SA exposes some logging mechanism which can dump
the usage like echo on engine ?

-- 
Cheers,

- A

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: one-to-one/many-to-one

2007-10-12 Thread jon

Changing the Relation declaration to 'project_studio' fixed this.
Thanks for the advice.

On Oct 12, 11:58 am, Michael Bayer [EMAIL PROTECTED] wrote:
 On Oct 12, 2007, at 2:46 PM, jon wrote:





  Hi,

  I have the following set up in a Pylons application:

  project_table = Table(PROJECT, metadata, autoload=True,
autoload_with=config['pylons.g'].sa_engine)

  studio_table = Table(STUDIO, metadata, autoload=True,
   autoload_with=config['pylons.g'].sa_engine)

  class Project(object):
  pass

  class Studio(object):
  pass

  mapper(Project, project_table, properties = {'studio' :
  relation(Studio)})

  mapper(Studio, studio_table)

  I'm using an Oracle database and the PROJECT table has a foreign key
  to STUDIO. But when I go to grab a Project object I get this error:

  sqlalchemy.exceptions.ArgumentError: Error determining primary and/or
  secondary join for relationship 'Project.studio (Studio)'. If the
  underlying error cannot be corrected, you should specify the
  'primaryjoin' (and 'secondaryjoin', if there is an association table
  present) keyword arguments to the relation() function (or for
  backrefs, by specifying the backref using the backref() function with
  keyword arguments) to explicitly specify the join conditions. Nested
  error is Can't find any foreign key relationships between 'PROJECT'
  and 'STUDIO'

  I'm following the SQL Alchemy docs 0.4beta6 and the syntax seems to be
  correct. Do I need primaryjoin? Help a noobie out ;-)

 it means that PROJECT and STUDIO have no foreign key relationship
 between them, so sqlalchemy cannot guess how to join those two tables.

 one thing I would do is, use project and studio as the table
 names (i.e. no uppercase), this indicates non-case sensitive
 reflection.  if still the same error, either spell out the Column
 objects in each Table explicitly (with the correct ForeignKey), or
 use the primaryjoin argument on your relation().

 hope this helps.

 - mike


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Connecting to a Microsoft Access Database

2007-10-12 Thread Paul Johnston

Hi,

 I  am very sorry for asking this question, but I was wondering if
anyone could give me a short step by step process as to how to access
a Microsoft Access Database using SQLAlchemy.
  

Access support is experimental. Use the lastest 0.4 trunk, as I've 
committed a few fixes just now. Beyond that, all you do is use 
SQLAlchemy as with  any other database. The DBURI is like 
access:///c:/my/file.mdb

There's some more info here: 
http://www.sqlalchemy.org/trac/wiki/DatabaseNotes#MicrosoftAccess

Paul

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Connecting to a Microsoft Access Database

2007-10-12 Thread Eddie

Just giving a little more information on what I can't figure out...

All I'd like to know is the few lines of code to open and connect to
an existing .mdb file.

So far, I have registered the mdb file as a DNS and named it VCPDB.

Three lines of my code look like:

metadata = MetaData()
engine = create_engine('mssql://VMCPDB', echo=True)
metadata.bind = engine

However, I can't insert into / query the db afterwards

ANY help would be greatly appreciated. Great job on SA so far. It
looks very impressive.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---