Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.venv/
access_parser.egg-info/
# Python-generated files
__pycache__/
*.py[oc]
build/
**/__pycache__/
dist/
wheels/
*.egg-info

# Virtual environments
.venv
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Microsoft Access (.mdb / .accdb) database files parser. The parsing logic is ful
# Installing
Use pip: `pip install access-parser`

Or install manually:
Or install from source with uv:
```bash
git clone https://github.com/ClarotyICS/access_parser.git
cd access_parser
python3 setup.py install
uv sync
```

# Demo
Expand All @@ -27,11 +27,42 @@ print(db.catalog)
# Tables are stored as defaultdict(list) -- table[column][row_index]
table = db.parse_table("table_name")

# Access values use their corresponding Python types. In particular:
# Date/Time -> datetime.datetime, GUID -> uuid.UUID,
# Currency and Numeric/Decimal -> decimal.Decimal.

# Pretty print all tables
db.print_database()

```

## SQL Queries

Copy some or all parsed tables into a query-only, in-memory SQLite database:

```python
db = AccessParser("/path/to/mdb/file.mdb")
sql = db.to_sqlite(["Customers", "Orders"])

rows = sql.execute(
"""
SELECT Customers.Name, SUM(Orders.Total)
FROM Customers
JOIN Orders ON Orders.CustomerID = Customers.ID
GROUP BY Customers.Name
"""
).fetchall()

sql.close()
```

Omit the table list to import every table in `db.catalog`. The original Access
database is never modified; selected tables are fully parsed and copied into
memory before SQLite runs the query. Date/Time and GUID values are copied as
canonical text. Currency and Numeric/Decimal values are also copied as exact
text because SQLite has no arbitrary-precision decimal storage class; SQLite's
built-in numeric arithmetic may coerce those values to inexact floating point.

### Known Issues
*

Expand Down
1 change: 0 additions & 1 deletion access_parser/__init__.py

This file was deleted.

261 changes: 0 additions & 261 deletions access_parser/parsing_primitives.py

This file was deleted.

Loading