Hello,

I'm working on a web project using Pylons. I'd like to write controllers 
that would automate form generation (CRUD - Create Read Update Delete).

The idea is to look at a SA table and generate the corresponding HTML 
forms, with error handling.

For example, if I see a column that is not nullable, I would add a * to 
the input form saying this is a required field.

Also I could generate a drop down list when I see a ForeignKey that 
would point to every items that the column refers to. (something close 
to Django's admin interface)

But there are some fields I don't want to display, like the ID, which in 
some case would not be of any use for the user.

I can see that the "hidden=True" argument is available for a Column 
object. But using this argument doesn't seem to make the table function 
in any good maner.

I'm not sure how it would be used, but the documentation seems to say 
that the Column should not be listed in the table's list of columns if 
hidden=True is set. I suppose the "list of columns" is the one returned 
by the Model.c.keys() method.

I have a DynamicMetaData and I'm using it's metadata.create_all() 
method. But it fails creating the corresponding hidden Column in the 
database. I think hidden should only *hide* the corresponding column in 
the list, but should still create and access the Column when needed 
(otherwise, what would be the use of "hidden" ? Then just don't create 
the column).

Also, when creating a table .create_all(), "hidden=True" returns an 
error when the column is "primary_key=True" or "unique=True":

sqlalchemy.exceptions.SQLError: (OperationalError) (1072, "Key column 
'name' doesn't exist in table") 'CREATE UNIQUE INDEX ux_clients_name ON 
clients (name)' ()

I suppose this is not the wanted effect.

Also, I was wondering how I could parse an SA table to see which column 
is a primary_key *AND* is a auto increment (a suggorate key). It seems 
that SA sends a SQL AUTO_INCREMENT command at the table creation when a 
column is set as a primary_key and is an Integer type. Which I think is 
not the right behaviour. I think we should be able to explicitly say 
that a Column is an Integer and have some "auto_inc=True" argument 
available somewhere.

I'm new to databases and only had experiments with MySQL. I don't know 
if other databases use suggorate keys other than INT types.

This is just a feel from outside. I haven't got into the SA source code 
to see how it all works together. And maybe what I'm looking for is not 
at all what I'm pointing at.

Regards,
-- 
Alexandre CONRAD

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

Reply via email to