Skip to main content

sqlantipathy

Python facilities to easily work with SQL databases

Ok, I don't love work with SQL databases. But the world works with SQL, then...

During last years I wrote lot of function to work with MSSQL, MySQL, Oracle, SQLite...
This project represent my personal attempt to systematize experiences, code, and approaches in few useful classes.

Of course sqlalchemy is a sort of de facto standard in python/SQL approach, and my package will never be such mature... but in my opinion it is not so simple and not ever backward compatibility is guaranteed with pyodbc and other low level libraries.

At this moment master branch only implements MSSQL routines. MySQL and Oracle rootines will be added as soon as possible.

Installation

Install sqlantipathy is as easy as run pip install sqlantipathy.

Usage

A more accurate description of methods included in sqlantipathy will follow. By now, you can refers to main.py file content:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from sqlantipathy import MssqlAntipathy
import pandas as pd

if __name__ == '__main__':

    sql = MssqlAntipathy(
        hostname="sql_hostname",
        user="sql_user",
        pwd="sql_pwd",
        driver="sql_driver_name"
    )

    sql.connect()

    database_list = sql.show_databases()

    sql.use_database("mydb")
    mydb_tables = sql.show_tables()

    qry = """SELECT TOP 100 * FROM TABLENAME"""
    data = sql.retrieve("sql_input_db", qry)

    list_of_dict = sql.retrieve("sql_input_db", qry)
    df = pd.DataFrame(list_of_dict)

    sql.close_connection()

    # A lot of code after...

    sql.connect()
    sql.cursor.execute("""A SIMPLE QUERY""")
    raw_data = sql.cursor.fetchall()

Release files for sqlantipathy 0.0.73

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

Source distribution (sdist)

Source distribution for sqlantipathy 0.0.73
File Size Uploaded
sqlantipathy-0.0.73.tar.gz 23.0 kB Details

Release files / sqlantipathy-0.0.73.tar.gz

Download URL sqlantipathy-0.0.73.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2f28e6c29e433b703238dcb97f07651e5bf5c47615f8c48e4ab0cd39728bca62
BLAKE2b-256 checksum
How to use checksums
21c95cd8d9d270ef5ad86a768e63061f076e90aef2e0e538933c57c680c0c45c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.73 This release

1 release file

0.0.72

1 release file

0.0.71

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

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