-
Notifications
You must be signed in to change notification settings - Fork 2
converting_databases
mitt4git edited this page Mar 16, 2017
·
22 revisions
#Converting Database Schema: From Access to Django Audience: Developers looking to recreate this process for new databases or due to bugs discovered down the line necessitating starting over again
What follows is the process used to generate the Django schema (models.py) starting with the supplied Access 2010 database file.
##Install and Configure MySQL
- #Where to get it# Best way to install is downloading the 32-bit installer. https://dev.mysql.com/downloads/installer/
- The file downloaded will be "mysql-installer-web-community-5.7.17.0". Double click or right click install. This will open an installer where you would choose custom option and then select all 32 bit (x86) versions of MySQl server, Workbench 6.3 , MySQL connector/ODBC 5.3. Click next and select folder in program Files (x86).
- #how to run it# Click next again and make sure everything you need is selected. Click execute.
- This will be followed by a windows which let you setup a server. Let everything set to defualt and give a password when prompted. Keep this password written and safe. (This will be used later to connect to Access / Django). Pres Execute again for final installation.
- #any possible confusing or custom steps for this process#
Once installed, open workbench.
- (confusing step 1...)
##Connect to Access Database##
- #How to point MySQL at Access DB File# Go to database migration wizard in workbench. Click open ODBC admin at bottom and add a user dsn with MS access .mdb/.accdb link. (This link with only show up if you have same Access version - 32bit on the machine)
- After establishing ODBC, click on migrate button and bottom left of workbench. Input all connection parameters including .accdb ethno file location, MySQL DSN, username and password.
- There will be option of Access password as well in properties which can be added.
- Fill out all necessary paraetrs in Object migration ta(source, migration, create schema, create target. In create schema, one will create a blank schema and name it the same as Access.accdb name (users choice).
- Click next and okay and data migration will start. It may ask for few permissions and privileges intermittently. Click okay and next in all prompts.
- If everything is entered correctly, the migration will show success (few errors came because of connections issues at this point but was corrected after ODBC connection was established)
- One can now see the ethno.db schema at bottom left (or wherever your schema window is in workbench). This db has all tables and schema in it. One can now generate .sql script from this to create sql dump of this database. This .sql script will help in generating this database in future quickly from code window. ##Install Django and Dependencies
- There are two ways to install Django
- (List of dependencies and versions that need to be installed to the system (non-python packages, but DOES include python))
- (Spinning up your virtual environment - any particularly complicated steps)
command line entries look like this!
- (List of python packages to be installed to your virtual environment)
##Generating your Django Schema
- (? create new Django project)
- (Django settings for MySQL backend)
- (Process or command that actually reads the MySQL DB and creates the models.py file for Django)