Hello,

I'm trying to set up database access using SQLAlchemy, and wanted to  
get some advice from the experts on how to proceed. I'm using  
PostgreSQL as my database (shouldn't be important, I know) and will  
specify foreign keys in the database. I do not want to create or  
modify database tables via python - I will use other tools for that.  
This is what I'd like to do:

- Have a script that will connect to the database, read the schema,  
and generate a single file. This will be a python script that  
generates the definitions of all the classes, relationships, etc.

- I want to use reflection whenever possible.

- I want this output file to be considered read only such that when I  
modify the database, I can rerun the script and regenerate it with the  
changes.

- I want to create a second python script that will contain one class  
definition for each in the first file. For example, let's say I have a  
table called "plate". The first file will contain the full definition  
for a class called "Plate_". The second file might contain:

class Plate(Plate_): pass

The second definition is a subclass of the first where I can put  
custom logic (if I need any) for each class. This is the class I will  
use in my scripts. I will then import this file from the many scripts  
I need to write that use this database.

(If anyone here has used WebObjects they'll know what I'm trying to do  
here.)

I've looked at Elixir, SQLSoup, and sqlautocode. I don't think any of  
these do quite what I'm trying to do here. I've only started to play  
with SQLAlchemy, and I'm a little frustrated at how much code I need  
to write to start using it, code that can certainly (and should) be  
generated.

I'd appreciate any advice on how best to approach this. Also, please  
let me know if I'm missing something from existing tools.

Cheers,

Demitri

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to