On 02/05/2017 09:07 PM, Oleg Broytman wrote: > Please reread carefully all my comments and the code in the previous > message. I already pointed to the root of the problem. > > On Sun, Feb 05, 2017 at 09:01:15PM +0100, janemba <cap.jane...@gmail.com> > wrote: >> On 02/05/2017 07:43 PM, Oleg Broytman wrote: >>> On Sun, Feb 05, 2017 at 07:16:48PM +0100, janemba <cap.jane...@gmail.com> >>> wrote: >>>> Hi, >>>> >>>> I have an issue with table name. I use my own naming for class name but >>>> it doesn't correspond to the table >>>> name. So, I use sql_meta with table attribute but it doesn't work. >>> sqlmeta, not sql_meta. >>> >>>> I have the following error : >>>> >>>> sqlobject.dberrors.ProgrammingError: Table 'foo.bar' doesn't exist >>>> >>>> Is it possible to use custom class name that do not correspond to table >>>> name ? >>> Works for me. Example: >>> >>> from sqlobject import * >>> >>> __connection__ = "sqlite:/:memory:?debug=1&debugOutput=1" >>> >>> class Person(SQLObject): >>> class sqlmeta: >>> table = 'city_person' >>> name = StringCol() >>> pets = MultipleJoin('Animal', joinColumn='owner_id') >>> >>> class Animal(SQLObject): >>> class sqlmeta: >>> table = 'city_animal' >>> name = StringCol() >>> owner = ForeignKey('Person') >>> >>> Person.createTable() >>> Animal.createTable() >>> >>> Debug output: >>> >>> 1/QueryR : CREATE TABLE city_person ( >>> id INTEGER PRIMARY KEY AUTOINCREMENT, >>> name TEXT >>> ) >>> 2/QueryR : CREATE TABLE city_animal ( >>> id INTEGER PRIMARY KEY AUTOINCREMENT, >>> name TEXT, >>> owner_id INT CONSTRAINT owner_id_exists REFERENCES city_person(id) >>> ) >>> >> That's strange, here what I do : >> >> class User(sqlobject.SQLObject): >> class sql_meta: >> table = 'tbl_user' >> idName = 'user_id' >> idType = int >> >> user_firstname = sqlobject.StringCol(length=45) >> user_lastname = sqlobject.StringCol(length=45) >> user_email = sqlobject.StringCol(length=45) >> user_phone = sqlobject.StringCol(length=20) >> user_password = sqlobject.StringCol(length=128) >> user_city = sqlobject.StringCol(length=45) >> user_country = sqlobject.StringCol(length=45) >> >> User.get(1) >> >> 1/QueryOne: SELECT user_firstname, user_lastname, user_email, >> user_phone, user_password, user_city, user_country FROM user WHERE >> ((user.id) = (1)) > Oleg.
Oups sorry...problem fixed :) ------------------------------------------------------------------------------ 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