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

2007-10-13 Thread Simon Pamies


On 12.10.2007, at 18:46, Gaetan de Menten wrote:


On 10/12/07, Simon Pamies [EMAIL PROTECTED] wrote:


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.


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. Or, to say that differently, I don't
see the point of having a repr method which doesn't produce a ready to
use string representation of the object if it's possible to do. That's
what the __repr__ method is for. And here, it's obviously possible
since you guys do it.


Sounds reasonable to me (after some thinking and realizing that repr  
can generate database independent code). But this decision will not  
be taken by me.


I'll try to do the following: Provide stable and well designed repr  
methods (currently the formatter has some rough edges) and it'll be  
up to Michael to decide if he wants that in sqlalchemy core.


Simon




PGP.sig
Description: This is a digitally signed message part


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

2007-10-13 Thread Simon Pamies


On 12.10.2007, at 18:56, Paul Johnston 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.


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.


Nice - will check that and will come back to you if I have questions.

Simon




PGP.sig
Description: This is a digitally signed message part


[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] 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] 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: 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] Re: FYI: AutoCode moved to a new repository

2007-10-11 Thread Werner F. Bruhin

Simon,

Simon Pamies wrote:
 Hi,

 although I said I would start on Friday if there are no objections, I
 couldn't longer resist to revamp autocode and so I moved it to google
 code.

 Please have a look at http://code.google.com/p/sqlautocode/ for the
 changes and the current structure.

 I also removed some contents from 
 http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode
 to reflect the move.

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

 If s/o has objections and/or wants to add information/data/code feel
 free to contact me.

 Simon Pamies
   
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.

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

Traceback 1:
Traceback (most recent call last):
  File autocode.py, line 140, in module
c.type = autoloader.coltypes[ c.type.__class__ ]()
KeyError: class 'sqlalchemy.types.Integer'

I don't know how to fix the above.

Traceback 2:
Traceback (most recent call last):
  File autocode.py, line 61, in module
dburl = engine.url.make_url(url)
NameError: name 'engine' is not defined

Just commenting the line dburl = engine.url.make_url(url) is fine as 
the dburl is not used.

Traceback 3:
Traceback (most recent call last):
  File autocode.py, line 71, in module
metadata = BoundMetaData(db)
NameError: name 'BoundMetaData' is not defined

Just change:
metadata = BoundMetaData(db)
to:
metadata = MetaData(db)

Traceback 4:
Traceback (most recent call last):
  File formatter.py, line 75, in module
sql._TextClause.__repr__ = textclause_repr
NameError: name 'sql' is not defined

I don't know how to correct this, but as FB doesn't use schema I did get 
around it by just commenting the block Monkey patching sqlalchemy repr 
functions

Question for FB:
What should be returned to the variable sqltext for indexes in the 
following code?

for name,tbl_name,sqltext in db.execute( me.sql4indexes):

The output for a table then looks like this:

I18N_CURRLANG   
  
= 
Table('I18N_CURRLANG

', 
MetaData(Engine(firebird://SYSDBA:[EMAIL 
PROTECTED]/c:/dev/twcb/data/i18n.fdb)), 
Column(u'id', Integer(), primary_key=True, nullable=False), 
Column(u'user_name', String(length=80,convert_unicode=False)), 
Column(u'lang', String(length=20,convert_unicode=False), 
nullable=False), schema=None)

It would be nice to add maybe a pretty print option so it would look 
more like this:

I18N_CURRLANG  = Table('I18N_CURRLANG',
  
MetaData(Engine(firebird://USER:[EMAIL PROTECTED]/c:/dev/twcb/data/i18n.fdb)),
  Column(u'id', Integer(), primary_key=True, nullable=False),
  Column(u'user_name', 
String(length=80,convert_unicode=False)),
  Column(u'lang', String(length=20,convert_unicode=False), 
nullable=False), schema=None)

Another option would be nice to replace:
  
MetaData(Engine(firebird://USER:[EMAIL PROTECTED]/c:/dev/twcb/data/i18n.fdb)),

with just:
  metadata

I.e. just the variable for metadata, so that one can assign an engine at 
run time.

Another thing is the table names, but I believe this is an FB issue, 
they should be .strip()'ed and I also do a .lower() on them, so they 
look nicer (in my tests this does not cause any problems).

When these things are worked out I'll send you the little bit of code 
need in loader.py for FB.

Best regards
Werner

--~--~-~--~~~---~--~~
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-11 Thread Paul Johnston
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

--~--~-~--~~~---~--~~
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-11 Thread John M Camara

 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.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---