I have many tables, but I will send one as this happening to all.
################################################
db.define_table('t_macro',
Field('f_codigo', 'integer', label=T('Codigo')),
auth.signature,
format='%(f_codigo)s',
)
db.define_table('t_indicadores_macro',
Field('f_macro', db.t_macro,label=T('Macro')),
Field('f_2006', 'integer',label=T('2006')),
Field('f_2007', 'integer',label=T('2007')),
Field('f_2008', 'integer',label=T('2008')),
Field('f_2009', 'integer',label=T('2009')),
Field('f_2010', 'integer',label=T('2010')),
Field('f_2011', 'integer',label=T('2011')),
Field('f_2012', 'integer',label=T('2012')),
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',
)
postgres returns me this
postgres.png ( annex)
How to import csv utility can make the correct allocation. it has a
bug, I have not yet discovered qual.mas are working.
Massimo, there is some time ago I did a conversion and at least the
definition of the bank was transferred sqlite identical, the same
sequence. ta problem with this now. I do not know why but I hope that
we find the problem.
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 Massimo Di Pierro <[email protected]>:
> Can you privately email me the model and the data you are trying import? I
> guess some recent patch must have broken the import.
>
>
> On Sunday, 3 June 2012 11:42:56 UTC-5, david.waldrop wrote:
>>
>> 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>>

