Hi Niphlod, thanks you for the suggestion I solved even that error and I added check_reserved=['common','postgres', 'sqlite'] to avoid future problems.

Unfortunately now I am getting an error saying:

relation "pictures" does not exist

which is the first field set as reference.
the table definition is the following:

db.define_table('route',
        Field('name', 'string',
requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'route.name'), IS_CAPITALIZE()]),
        Field('user_id', db.auth_user, default=auth.user_id),
Field("slug", "string", requires=[IS_SLUG(),IS_NOT_IN_DB(db,'route.slug')]),
        Field('length','double', default=random.randint(0, 50)),
        Field('height','integer', default=random.randint(0, 50)),
Field('max_elevation','integer', default=random.randint(0, 50)),
        Field('max_elevation_lat', 'double'),
        Field('max_elevation_lgt', 'double'),
Field('min_elevation','integer', default=random.randint(0, 50)),
        Field('min_elevation_lat', 'double'),
        Field('min_elevation_lgt', 'double'),
        Field('start', 'string'),
        Field('endC', 'string'),
Field('photo_id', 'reference pictures', readable=False, writable=False), Field("signs", 'reference signs', readable=False, writable=False), Field("kml", "upload", uploadfolder=request.folder+'uploads/kml', uploadseparate=True), Field("svg_altitude", 'string', readable=False, writable=False), Field("desc_it",'reference description', readable=False, writable=False ), Field("desc_en",'reference description', readable=False, writable=False ), Field("desc_de",'reference description', readable=False, writable=False ), Field("desc_es",'reference description', readable=False, writable=False ),
        Field("categories", 'list:reference route_category'),
Field("status", 'string', requires=IS_IN_SET(['public', 'review', 'work_in_progress']), default='work_in_progress'),
        auth.signature,
        format='%(name)s (%(id)s)'
)

what should I do?

--
 Paolo


Il 13.06.2012 20:48 Niphlod ha scritto:
yes, you're using "end" as column name....this is not allowed in
postgres and oracle, and also on mssql.

Bites me every time, but actually a good practice would be to create
the model within a connection made this way:

db = DAL(uri, check_reserved_keyword=['all'])

it will stop your model creation if find some tablename/columnname
that is not allowed in all db engines, so you can have a "portable" db
schema between different db engines. Better start with a "universally
accepted" model also in local developments with sqlite than having
those errors when trying to migrate to your production server.

PS: check_reserved_keyword take a list of db engines to check against, so if you're worried only to "be portable" within postgres and sqlite,
you can replace ['all'] with ['common', 'sqlite', 'postgres']


Reply via email to