This package provides utilities for interacting with PostgreSQL and SQLite databases, including data insertion, querying, schema inspection, and metadata extraction. It also includes unit tests and helper functions for logging, file handling, and data parsing.
-
spire_pipeline.py
Simple script that creates local SQL tables from data files.- Catalogs and parses files for metadata.
- Links raw data with metadata using relational concepts.
- Allows historical data to be queried, accessed, and re-used.
- Prepares future projects for ontology development and infrastructure.
-
postgres_operations.py
Contains thePostgresDBclass for PostgreSQL operations:- Connect to a PostgreSQL database.
- Insert data from pandas DataFrames.
- Query records by date, fetch table schemas, and retrieve table metadata.
- Error handling and logging.
-
sqlite_operations.py
Contains theSQLiteDBclass for SQLite operations:- Read/write data to SQLite tables.
- Insert records via DataFrames or single entries.
- Join module metadata and retrieve the latest measurement dates.
-
test_postgres_operations.py
Unit tests forPostgresDBmethods (e.g., DataFrame insertion, schema queries). -
test_sqlite_operations.py
Unit tests forSQLiteDBmethods (e.g., record creation, metadata joining).
utils.py
Helper functions for:- Logging configuration.
- File selection GUI.
- Metadata extraction from filenames.
- Array deserialization and folder traversal.
Dependencies:
pip install pandas sqlalchemy numpy tkinter