A library for reading tables from an Access database into Polars dataframes, using mdbtools
A tiny, subprocess-based tool for reading a
MS Access
database (.mdb, .accdb, .rdb) as a Python Polars Dataframe.
To read the database, this package thinly wraps MDBTools.
If you are on macOS, install it via Homebrew:
$ brew install mdbtoolsIf you are on Debian, install it via apt:
$ sudo apt install mdbtoolsIf you are on Windows, it's a little tougher. Install mdbtools for Windows. Manually add to PATH.
- Download the mdb-tools files from Windows link above. Visit the Releases section, then download the part that says "Source Code (zip)".
- Extract that to somewhere like
C:/bin/mdbtools-win/mdbtools-win-1.0.0. - Follow these instructions to add that folder to your environment path (Method 1, but use the path to the mdbtools executable files).
- Restart your computer or just close and re-open the program you're running it from. You can test that it works by opening a terminal and running
mdb-tables --helpand see that it doesn't fail.
Finally, on all OS's:
$ pip install polars_access_mdbtoolsimport polars as pl
import polars_access_mdbtools as pl_access
file_path = "path_to_file.mdb"
print(pl_access.list_table_names(file_path))
df: pl.DataFrame = pl_access.read_table(file_path, table_name="your_table_name")This code is based heavily on jbn's pandas_access library.
Please Star this repo.
Please submit bug reports as GitHub Issues. Feel free to submit a PR to fix an issue!