How to import .MDF Database?

How can I import an existing database to my db.py model?

  • I have successfully changed the default sqlite connection to mysql. Now I want to import an exported file (database.sql) which is an existing database. I need help on how I can do this please

  • Answer:

    In a perfect world all you would need to do is dump your database to some file and import it in mysql. That is just open a mysql shell and execute the database.sql file... However, there can be some differences in the syntaxes of sqlite and mysql. In order to avoid these problems you can use a converter tool: http://www.sqlite.org/cvstrac/wiki?p=ConverterTools As far as I remember the asker uses web2py. I've never used this, but it seems that you can use its DAL to do the conversion as well: http://www.web2py.com/AlterEgo/default/show/196

Julius Bier Kirkegaard at Quora Visit the source

Was this solution helpful to you?

Other answers

first make your model match your db -- meaning column names and data types then add the following to you DAL fake_migrate=True so in my project it looks like so normal production modeĀ  -- db = DAL(settings.production_database_uri, 5) I have messed with the db and want the project to sync to the db -- db = DAL(settings.production_database_uri, 5,fake_migrate=True) then restart the serverĀ  once, remove the fake_migrate=True and restart the server again. at this point your db and model should be in sync

Isaac Jessop

Good that you were able to get mysql installed and configured it on web2py yourself! The new http://db.py just creates tables on mysql using the schema that you define on http://db.py. From there, it is just another table. Just move your rows from any other table or database using queries. (you can just google on how to export / import databases / tables in mysql for this)

Rajaram Srinivasan

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.