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.11.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.11-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: acma_orm-0.1.11.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.11.tar.gz
Algorithm Hash digest
SHA256 af3ed2e9e98ca5144bdaa417eaf07fd75f038e51c65e90df9abe42da0594703d
MD5 8591f7d1cf688892d009e41d0136e6b5
BLAKE2b-256 0c8ef75d244102e802c3c487bff6ce775e976717af7f0d9824939b70b2984cf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: acma_orm-0.1.11-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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 81fd3c2816d9015ddbed6d2ce1d8b0956da0ecc67c7f8660f0437b5a717d1674
MD5 b3091170ecfdaffe343bb35927944bcc
BLAKE2b-256 15e04f780d359bcf186860f83ef8b29526b9e6b7b24a4602f2fcc2436e4c6c35

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