Hi! Welcome!

On Sun, Feb 05, 2017 at 11:54:50AM +0100, janemba <cap.jane...@gmail.com> wrote:
> Hi,
> 
> I'm new SQLObject and I'm reading multiple documentations. I noticed
> that primary key is implicitly created by SQLObject by using "id"
> column. However, I want to use a custom one with a different name (my
> columns and tables are already created). How can I do that ?

   SQLObject requires that tables have single PRIMARY KEY columns, not
necessary integer (strings are ok) and not necessary named 'id'. But the
PRIMARY KEY must be single column, and SQLObject always refers to the
column as '.id'.
   You can declare name and type of the column in sqlmeta inner class:

class MyTable(SQLObject):
    class sqlmeta:
        idName = 'my_id'
        idType = str

> Cheers

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            p...@phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to