In my long walks migrate sqlite to postgres, I detected that the import_csv has problems when there is this relationship and the table with no records, made the importation into the hand he behaves well. but definitely we know and know that Massimo has import_csv problems sqlite -> to <- Postgresql.
Ovidio Marinho Falcao Neto Web Developer ovidio...@gmail.com ovidiomari...@itjp.net.br ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/6/13 Massimo Di Pierro <massimo.dipie...@gmail.com>: > Sorry. I asked a stupid question. Not sure what is wrong. I am looking into > possibilities. > > On Wednesday, 13 June 2012 17:38:07 UTC-5, Gabriella Canavesi wrote: >> >> Yes off course :-) >> It is just below the route table definition, here: >> >> db.define_table('pictures', >> Field("picture", "upload", requires=(IS_NOT_EMPTY(), >> IS_IMAGE())), >> Field("normal", "upload", IS_IMAGE()), >> Field("thumbnail", "upload", IS_IMAGE()), >> Field('route_id', db.route, default=db.route.id), >> Field('user_id', db.auth_user, default=auth.user_id), >> Field('created_on', 'datetime', default=request.now), >> Field('description', 'text', requires=[IS_TRIM(), >> IS_LENGTH(140,error_message=T('Warning, description too long'))]) >> ) >> >> paolo >> >> Il 14.06.2012 00:34 Massimo Di Pierro ha scritto: >> > Do you have a >> > >> > db.define_table('pictures',....) >> > >> > ? >> > >> > On Wednesday, 13 June 2012 17:21:52 UTC-5, Gabriella Canavesi wrote: >> > >> >> 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 [1]'), >> >> 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'] >> > >> > >> > Links: >> > ------ >> > [1] http://route.name