BTW, I'm using an existing table with a number of ENUM columns. What
I'm looking for is a solution to get those ENUM lists in a
SingleSelectField.
On 24 apr, 10:15, aka <[EMAIL PROTECTED]> wrote:
> Hi Jorge,
> I'm using SO with MySQL.
> I could get around it by using
> "SHOW COLUMNS FROM Rol LIKE '%s'" % (column)
> and stripping obsolete characters but there should be possibly more
> efficient ways to do it.
> What I saw on the MySQL site was this code:
>
> def EnumValues(dbh, column):
> dbh.execute("SHOW COLUMNS FROM pages LIKE '%s'" % (column,))
> column_definition = dbh.fetchone()
> values = re.findall("'(.+?)'", column_definition['Type'])
> return values
>
> with MySQLdb.cursors.DictCursor used as the connection's cursorclass
> (and dbh as a cursor object for that connection), but I can't get that
> cursor right.
> Another one is: how can you update an ENUM list?
>
> On 24 apr, 02:02, "Jorge Vargas" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Wed, Apr 23, 2008 at 8:09 AM, aka <[EMAIL PROTECTED]> wrote:
>
> > > Hi, can somebody tell me how to retrieve ENUM values from MySQL db in
> > > TurboGears?
>
> > is this SA or SA? are you reflecting an existing table?
>
> > here is a pointer for
> > SAhttp://www.sqlalchemy.org/docs/04/sqlalchemy_databases_mysql.html#doc...
> > I'm not entirely sure of there is a cross-db for getting those as they
> > are not implemented in all db-engines.
>
> > > Cheers- Tekst uit oorspronkelijk bericht niet weergeven -
>
> > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk
> > bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---