write_mdb_to_csv¶
A simple script to dump the tables of a Microsoft Access Database to multiple CSV files.
It depends upon the mdbtools suite.
To install the suite: Linux: sudo apt install mdbtools OSX: brew install mdbtools Windows: https://github.com/lsgunth/mdbtools-win but not tested, check this thread: https://github.com/brianb/mdbtools/issues/107
If not using the –tables_names it dumps all tables.
- Example command line to dump all tables:
python mdb_to_csv.py test.mdb data
- Example command line to dump specific tables:
python mdb_to_csv.py test.mdb data --table_names VM_GEGEVENS,VM_RVVCODE
usage: write_mdb_to_csv [-h] [--table_names TABLE_NAMES [TABLE_NAMES ...]]
mdb_file output_folder
Positional Arguments¶
mdb_file | filename and location of mdb file, for example data/test.mdb |
output_folder | Specify the desired output folder path, for example: app/data |
Named Arguments¶
--table_names | Optional argument. Standard all tables are dumped, You can use this option to specify one or more table names, For example:–table_names VM_GEGEVENS,VM_RVVCODE |
functions¶
-
datapunt_processing.extract.write_mdb_to_csv.
dump_mdb_tables_to_csv
(mdb_file, output_folder, table_names)¶ Dump each table as a CSV file using “mdb-export” and converting ” ” in table names to “_” for the CSV filenames.
-
datapunt_processing.extract.write_mdb_to_csv.
get_tables_mdb
(mdb_file)¶ Get the list of table names with “mdb-tables” for a *.mdb file using latin1 as encoding.
-
datapunt_processing.extract.write_mdb_to_csv.
parser
()¶ Parser function to run arguments from commandline and to add description to sphinx docs. To see possible styling options: https://pythonhosted.org/an_example_pypi_project/sphinx.html