Perhaps this can explain something, I have it on my definition:
db.define_table('t_indicadores_estado',
Field('f_ano', 'integer',label=T('Ano')),
Field('f_taxa', 'integer', label=T('Taxa')),
Field('f_numero', 'integer', label=T('Numero')),
Field('f_nome', 'string',label=T('Nome')),
Field('f_categoria', 'string', label=T('Categoria')),
Field('f_mapa', 'upload',label=T('Mapa')),
auth.signature,
format='%(f_nome)s',
)me and postgres generates this: postgres.png Como o utilitario de importar csv pode fazer a alocaçao correta. tem algum bug nisto, eu ainda nao descobri qual.mas estamos trabalhando. Ovidio Marinho Falcao Neto Web Developer [email protected] [email protected] ITJP - itjp.net.br 83 8826 9088 - Oi 83 9334 0266 - Claro Brasil 2012/6/3 Ovidio Marinho <[email protected]>: > I'm following the discussion and would like it because it really > worked for me is the third time I have to migrate sqlite to postgres > and options listed do not work, at least in large applications in a > small application that can work, but when you have many relationships > and diversity of types of attributes, the scripts always generate > errors. I am again having to do the procedure manual. > > > > Ovidio Marinho Falcao Neto > Web Developer > [email protected] > [email protected] > ITJP - itjp.net.br > 83 8826 9088 - Oi > 83 9334 0266 - Claro > Brasil > > > > 2012/6/3 David Waldrop <[email protected]>: >> Massimo, I am basically using the examples right form the book. I am >> deleting the local SQLlite database and the tables (now that I have a handle >> on the migration stuff) and would like to copy the current postgress >> production database to the local sqlite version. I tried at 1st with >> meeting monkey and noted the relationships between records in different >> tables is not preserved. I also trued with COPSIS and have a similar >> situation. Does Import/Export know how to maintain relationships across >> tables using the original primary and foreign keys? >> >> >> >> Code from book I am using -> >> >> >> >> def dumpdb(): >> >> >> #download(db.export_to_csv_file(open('c:/meetingmonkey_back_up.csv','w'))) >> >> import StringIO >> >> s = StringIO.StringIO() >> >> db.export_to_csv_file(s) >> >> response.headers['Content-Type'] = 'text/csv' >> >> return s.getvalue() >> >> >> >> >> >> def loaddb(): >> >> form = FORM(INPUT(_type='file', _name='data'), INPUT(_type='submit')) >> >> if form.process(session=None).accepted: >> >> db.import_from_csv_file(form.vars.data.file,unique=False) >> >> # for every table >> >> #for table in db.tables: >> >> # # for every uuid, delete all but the latest >> >> # items = db(db[table]).select(db[table].id, >> >> # db[table].uuid, >> >> # orderby=db[table].modified_on, >> >> # groupby=db[table].uuid) >> >> # for item in items: >> >> # db((db[table].uuid==item.uuid)&\ >> >> # (db[table].id!=item.id)).delete() >> >> return dict(form=form) >> >> >> >> From: [email protected] [mailto:[email protected]] On Behalf Of >> Massimo Di Pierro >> Sent: Sunday, June 03, 2012 12:11 PM >> To: [email protected] >> Subject: [web2py] Re: Trouble migrating databases >> >> >> >> Hello David, >> >> >> >> glad to know this was resolved. I was looking into it on my side and I do >> not know what may have caused it. My guess is that you had migrations off, >> you upgraded and auth needed to add some fields but migrations where off. >> What happened after that I do not know. >> >> >> >> About export/import. Are you doing it for one table at the time or for all >> tables are once? Can you show us some code? >> >> >> >> Massimo >> >> On Sunday, 3 June 2012 09:45:00 UTC-5, david.waldrop wrote: >> >> Some minor breakthru. I have fixed "most" (that I know of) of the >> migration errors - Manually. >> >> I was successful at using the DAL option fake_migrate_all = True and >> migrate_enabled = True which created some of the *.Table files - (but not >> all, also this did not seem to do anything to help except for refresh the >> SQL.LOG) >> >> I then compared the structure in the SQL.LOG file to each table and added >> some missing fields directly to the sqllite database using a slqlite editor. >> >> I am back to where I need to be on the migration, but have no real idea what >> went wrong or if it will happen again. Needless to say this should be less >> complex and more transparent - even better if it "JUST WORKS, ALL THE TIME" >> >> >> >> One open question remains about Export_to_CSV,and import_from_CSV screwing >> up the relationships between records.....any insight would be much >> appreciated >> >> >> >>
<<attachment: postgres.png>>

