How do I specify that my id column should use UUID() to generate its primary_key?
I'm trying to connect to SugarCRM database with tables that use UUID for primary keys, while also having another auto_increment column. Example:
CREATE TABLE `campaigns` (
`id` varchar(36) NOT NULL default '',
`tracker_key` int(11) NOT NULL auto_increment,
`name` varchar(50) default NULL,
...
PRIMARY KEY (`id`),
KEY `auto_tracker_key` (`tracker_key`),
) ;
Imagine also that you have `Campaign` class connected to this table (id column has `primary_key = True`).
If you create new instance of this object `cam = Campaign(name='test')` and commit, you will get the following::
cam.id # 59L
cam.tracker_key # None
Which is clearly wrong. It should be:
cam.id # ''
cam.tracker_key # 59L
Thanks,
Tvrtko
- [Sqlalchemy-users] How to specify that ID column should use ... Qvx 3000
- Re: [Sqlalchemy-users] How to specify that ID column sh... Michael Bayer
- Re: [Sqlalchemy-users] How to specify that ID colum... Michael Bayer