Skip to main content

A Python ORM of the ACMA database

Project description

ACMA ORM

ACMA ORM is a Python library designed to quickly import the AMCA specrta_rrl data dump into a termporary SQLite database and provide an intuitive Peewee ORM interface for querying records. This library is intended to be used locally for data analytics.

Features

  • Bulk CSV Import: Efficiently load ACMA CSV dumps into a SQLite database using Pandas
  • ORM Interface: Query your data using Peewee ORM. Examples provided below

Installation and Usage

pip install acma-orm

Download spectra_rrl and extract all files into path/to/spectra_rrl_directory (wherever you want, as long as Python can find it)

Once installed use like below:

from acma_orm.importer import import_all_data
from acma_orm.models import Licence, Client
from playhouse.shortcuts import model_to_dict

# Import your CSV dump (ensure your CSV files are in the specified folder)
import_all_data("path/to/spectra_rrl_directory")

# Query licences for a specific client.
query = (Licence
         .select(Licence)
         .join(Client)
         .where((Client.licencee == "TELSTRA LIMITED") &
                (Client.trading_name == "Telstra - Commerical Engineering - Spectrum Strategy")))
for licence in query:
    print(model_to_dict(licence, recurse=True))

Contributing

  1. Install UV:

    pip install uv
    
  2. Close the Repo and sync environment

    git clone https://github.com/jacksonbowe/acma-orm.git
    cd acma-orm
    
    uv sync
    
  3. Download spectra_rrl and extract all files into examples/spectral_rrl

  4. Run Example Scripts:
    The examples/ directory contains individual scripts that demonstrate various query types. For instance, run:

    uv run examples/init.py
    uv run examples/simple_query.py
    uv run examples/join_query.py
    uv run examples/aggregation_query.py
    uv run examples/complex_query.py
    

Project Structure

acma-orm/
├── pyproject.toml            # Build configuration for UV (and PyPI metadata)
├── README.md                # This file
├── LICENSE                  # License file (MIT License)
├── examples/                # Example scripts demonstrating package usage
│   ├── spectra_rrl/
│   │   ├── <put_spectra_rrl_data_in_here>
│   ├── init.py              # Run me first
│   ├── simple_query.py
│   ├── join_query.py
│   ├── aggregation_query.py
│   └── complex_query.py
├── src/
│   └── acma_orm/            # Package source code
│       ├── __init__.py      # Exposes package API (including enable_debug_logging)
│       ├── database.py      # Database connection and initialization logic
│       ├── importer.py      # Functions to import CSV data
│       └── models.py        # Peewee ORM model definitions

License

This project is licensed under the MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acma_orm-0.1.10.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acma_orm-0.1.10-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file acma_orm-0.1.10.tar.gz.

File metadata

  • Download URL: acma_orm-0.1.10.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.4

File hashes

Hashes for acma_orm-0.1.10.tar.gz
Algorithm Hash digest
SHA256 018d638afa3fa3608f73b41d142d51f0c402106a7562a293ebaff57cc7c8bc4a
MD5 1cd1a0116c6b72785db602b38ea71b81
BLAKE2b-256 e264a04a056809e483346534f4861eb9a7bce08e22a4d9c01021c307d9a6ed37

See more details on using hashes here.

File details

Details for the file acma_orm-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: acma_orm-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.4

File hashes

Hashes for acma_orm-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 12b2365a8209bf6fa7d7800465b822d58366a578f9de4f7fd3ccbc05d9eb1d6c
MD5 f9cd66044aa2c54a645376a0e787d225
BLAKE2b-256 ba8c0d16869117d79a32ebb52f497f189fe1bebe08d55c7ba3803eca60988f7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page