semvec/pypi-packages huggingface dataset:
sqlantipathy 0.0.73
Python library to work with SQL DB
License: MIT

# 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...<br>
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:

```python
#!/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()
```
sorted 0.1.0
Merge, subtract, deduplicate and otherwise manipulate Python iterators that are known to be sorted.
License: MIT

# Sorted containers

Contrary to its name, this package does not really help you to efficiently sort your data, - you may use built-in tools of Python, numpy or pandas for that purpose.

This tool, however, allows you to _declare_ that certain container is already sorted and, based on that information, perform certain operations on such containers more efficiently.

## Supported operations

* Merge two or more sorted iterators into one magnificent sorted iterator
* Subtract one sorted iterator from another, returning an iterator which yields all items that exist in the latter but not in the first
* Deduplicate a sorted iterator

## Examples

```python
from itertools import count, islice
from sorted import Sorted, merge

# Merge
print(list(Sorted([0, 2, 4]) + Sorted([1, 3, 5])))
# [0, 1, 2, 3, 4, 5]

# Subtract
natural_numbers = Sorted(count())
even_numbers = Sorted(filter(lambda i: i % 2 == 0, count()))
odd_numbers = natural_numbers - even_numbers
print(list(islice(odd_numbers, 5)))
# [1, 3, 5, 7, 9]

# Deduplicate
iterators = [
    Sorted((0, ) * 50),
    Sorted((5, ) * 50),
    Sorted(count(25))
]
list(islice(
    merge(*iterators).unique(),
    4
))
# [0, 5, 25, 26]
```

To perform these operations, `sorted` uses lazy iterative algorithms with linear complexity by time and constant complexity by RAM.