Skip to main content

Makes it easier to interact with sql server using python

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Aftonfalk

Aftonfalk is a module that makes it easier to interact with microsoft sql server. You can see it as an extension to pyodbc

How to install

pip install aftonfalk

Example usage

Instantiate a driver:

driver = MssqlDriver(
    dsn="mssql://sa:Password1!@host.docker.internal:31433",
    driver=r"{ODBC Driver 18 for SQL Server}"
)

Dropping a table using execute

driver.execute(sql=f"DROP TABLE source_system.schema.table;")

read & write data

data = driver.read(query="select * from tablex")
driver.write(sql="INSERT INTO tablex (column_name) VALUES ('column_value')", data=data)

Manage tables.

from aftonfalk.models.enums_ import SqlServerDataType
from aftonfalk.models.types_ import Column
from aftonfalk.models.tables.clean import RawTable

raw_table = RawTable(
    unique_columns=[
        Column(
            name="unique_key",
            data_type=SqlServerDataType.NVARCHAR.with_length(50),
            constraints="NOT NULL",
        ),
    ]
)

then you can do things like easily:

creating tables

path = "catalog.schema.table"
ddl = raw_table.table_ddl(path=path)
driver.create_table(path=path, ddl=ddl)

inserting into tables

data = ...
path = "catalog.schema.table"
insert_stmt = raw_table.insert_sql(path=path)
driver.write(sql=insert_stmt, data=data)

Notes

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

aftonfalk-0.1.5.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

aftonfalk-0.1.5-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file aftonfalk-0.1.5.tar.gz.

File metadata

  • Download URL: aftonfalk-0.1.5.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for aftonfalk-0.1.5.tar.gz
Algorithm Hash digest
SHA256 373e85c8073fd1282b79edd0c1148c71908a7b57d7e0d1a2a8f7f595265682b3
MD5 5cde5bb613a9e08741489de4855dacaf
BLAKE2b-256 57b9847f94f677816acf9bde138edee357cd953c940fba257c8500e320365ddf

See more details on using hashes here.

File details

Details for the file aftonfalk-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: aftonfalk-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for aftonfalk-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4f065a8adb103370bc6dc14a7fd3856e2014f2eacd9a4b7b8ef13f7ba9430e2d
MD5 9ac42205ddc9c43dbeb55359bd7b4657
BLAKE2b-256 3138f9bce2b17b3c34db93c8a98c8f09a92a7b53152609c988039c027653475a

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