Skip to main content

al-data-utils

Reusable Python utilities for data and automation workflows.

This repository contains independent utility modules for sync operations, git automation, SQL work, logging helpers, and MSSQL schema snapshot generation.

Install

pip install al-data-utils

Python 3.10+. Runtime dependencies (pyyaml, sqlalchemy, pandas, requests, msal, ...) are expected from the host environment, typically an Airflow image.

Modules

  • airflow_utils - Airflow Variable / connection helpers
  • azure_as_utils - Azure Analysis Services model refresh (REST + MSAL)
  • backup_utils - MSSQL schema snapshot to filesystem
  • config_utils - YAML config loading
  • files_sync_utils - folder inventory, sync plan, copy, retention
  • geo_utils - geo helpers
  • git_utils - git automation wrappers
  • logging_utils - unified logging
  • ones_api_utils - 1C/ОneS API client
  • sql_utils - UnifiedSQLClient (MSSQL / PostgreSQL / Snowflake via SQLAlchemy)
  • tg_utils - Telegram helpers

Examples

Runnable examples are available in the examples folder of the repository for the main utility groups. Use them as reference implementations for local scripts and automation jobs.

MSSQL Schema Snapshot

The snapshot tool exports SQL objects from MSSQL into a filesystem layout and syncs staging output to destination folders.

Current behavior highlights:

  • Supports single DB and multi-DB runs in one execution.
  • Always writes outputs into per-DB folders.
  • Uses staging first, then syncs to final output.
  • Supports cleanup of staging folders.
  • Supports sync log retention cleanup.
  • Supports include and exclude filters per object type.
  • Supports DataGrip template override files.

Output shape:

<MSSQL_OUT_DIR>/<DatabaseName>/schemas/<schema>/
	tables/
	views/
	routines/
	sequences/
	synonyms/

Snapshot Environment Variables

Core connection and output:

  • MSSQL_OUT_DIR
  • MSSQL_SERVER
  • MSSQL_DATABASE
  • MSSQL_DATABASES
  • MSSQL_AUTH_MODE
  • MSSQL_USER
  • MSSQL_PASSWORD
  • MSSQL_DRIVER

Snapshot behavior:

  • MSSQL_ENABLE_TABLE_DEFINITIONS
  • MSSQL_ENABLE_INDEXES
  • MSSQL_ENABLE_FOREIGN_KEYS
  • MSSQL_ENABLE_VIEWS
  • MSSQL_ENABLE_STORED_PROCEDURES
  • MSSQL_ENABLE_FUNCTIONS
  • MSSQL_ENABLE_SEQUENCES
  • MSSQL_ENABLE_SYNONYMS
  • MSSQL_CLEANUP_STAGING
  • MSSQL_SYNC_LOG_RETENTION_DAYS

Filters:

  • MSSQL_INCLUDE_SCHEMAS
  • MSSQL_EXCLUDE_SCHEMAS
  • MSSQL_INCLUDE_TABLES
  • MSSQL_EXCLUDE_TABLES
  • MSSQL_INCLUDE_VIEWS
  • MSSQL_EXCLUDE_VIEWS
  • MSSQL_INCLUDE_STORED_PROCEDURES
  • MSSQL_EXCLUDE_STORED_PROCEDURES
  • MSSQL_INCLUDE_FUNCTIONS
  • MSSQL_EXCLUDE_FUNCTIONS
  • MSSQL_INCLUDE_SEQUENCES
  • MSSQL_EXCLUDE_SEQUENCES
  • MSSQL_INCLUDE_SYNONYMS
  • MSSQL_EXCLUDE_SYNONYMS

Notes:

  • If MSSQL_DATABASES is set, it is treated as a comma-separated list.
  • If MSSQL_DATABASES is empty, MSSQL_DATABASE is used.
  • If MSSQL_DATABASE contains commas, it is also treated as a list for backward compatibility.

File Sync Utilities

files_sync_utils provides:

  • Inventory building
  • Plan generation
  • Copy and update execution
  • Extra destination cleanup rules
  • Activity CSV logging
  • Log retention cleanup

Git Utilities

git_utils wraps common git automation operations with consistent behavior and error handling.

Changelog

See CHANGELOG.md in the repository for release notes.

Metadata

Release files for al-data-utils 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for al-data-utils 0.3.3
File Size Uploaded Provenance Actions
al_data_utils-0.3.3.tar.gz 51.9 kB Without provenance Details for al_data_utils-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for al-data-utils 0.3.3
File Interpreter ABI Platform Actions
al_data_utils-0.3.3-py3-none-any.whl Python 3 none any Details for al_data_utils-0.3.3-py3-none-any.whl

Total release size: 117.4 kB

Release files / al_data_utils-0.3.3.tar.gz

Download URL al_data_utils-0.3.3.tar.gz
Size 51.9 kB
Tags Source
SHA-256 checksum
How to use checksums
057af0c215ca9feb4a06fe94ffd3342cd111532045d2b97edf2cd4873d2086f2
BLAKE2b-256 checksum
How to use checksums
a6e601a9522b9273d63a95f9bc5821a130ab5f5e9529f87bcc80ce2ba277514e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / al_data_utils-0.3.3-py3-none-any.whl

Download URL al_data_utils-0.3.3-py3-none-any.whl
Size 65.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4adfe754cc8d887c1613c94938dd3aa798a1e3ba1730f2fccf1d839e8737aadb
BLAKE2b-256 checksum
How to use checksums
91ea446005dde6afe60389d22485915eb59d6c415e19d9f40cc639f3c9b0945a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for al-data-utils 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page