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*
>
>
>
>
>