How to import mySQL data into Oracle APEX (the hard way)
Oracle Application Express (APEX) is a low-code development platform that enables you to build scalable, secure enterprise apps, with world-class features, that can be deployed anywhere.
Recently I was asked to import a mySQL
database into APEX.
Although support for mySQL
databases is on the roadmap, it seems like for now there's no straightforward way to import this data ... so here's a tutorial on how to do it the hard way.
Under "SQL Workshop" > "Utilities" > "Data Workshop" you can see that there's a feature that allows you to load data in multiple formats, including csv
:
So, I decided to create a Python script to grab the data from each of the tables in the mySQL
database and export it as an individual csv
file:
In order to run this script, make sure to install mysql-connector-python:
~ python3 -m pip install mysql-connector-python
Then, you can simply run:
~ python3 mysql-to-csv.py
By the end, you should have a directory full of csv
files which you can import, as such:
Note that you can only load one file at a time, and you also need to manually add the table's name.
Once you're done with importing the data you can go to "SQL Workshop" > "Object Browser" and see all of your tables, which you can then modify as needed:
Unfortunately, using this method you also need to add all of the constraints by hand.
I'm sure there is a better way to do this, but in the meanwhile here's a bad workaround, hope it helps!