semvec/pypi-packages huggingface dataset:
py-ms-sql 0.2.2
A small utility package that makes connecting to Microsoft SQL easier
Requires Python: >=3.6
Keywords: sql sqlserver

# Microsoft SQL Server Easy Connect
The purpose of this small utility, one class module is to make connecting to a MS SQL Server easier. One problem I experienced through putting python code in production is: the operating system makes a difference. So if one has a error-free project running on their Windows machine and then deploy it on a unix based server, errors appear. This modul is OS independant (with one caveat, see below) so that regardless of where you the project is deployed, it will run without errors. 

### Quick Start
```
$ pip install py_ms_sql
```

### Usage
```python
from py_ms_sql import py_ms_sql

# Set up connection object (OPTIONAL: pass a logger object)
sql_conn = py_ms_sql.ConnectSQL()

# Use one of the following (in order of ease-of-use)
# DSN of ODBC
state, msg = sql_conn.connect(dsn='mysqldsn', uid='user', pwd='password')

# OR
# ODBC Driver String
state, msg = sql_conn.connect(driver_string="{SQL Server};SERVER=server_name;" \
                               "DATABASE=my_db;UID=user;PWD=password")

# OR
# ODBC Driver Details
state, msg = sql_conn.connect(driver='{SQL Server}',server='server_name',
                 db='my_db',uid='user',pwd='password')

# OR
# Specify ODBC Driver Location
state, msg = sql_conn.connect(host="my-server.com",port=1433,db="my_db",
                 uid='user',pwd=password,tds_version=7.3
                 driver='/usr/local/lib/libtdsodbc.so')

# Run a SELECT statement query (return error status and Pandas DataFrame)
state, data = sql_conn.select(sql_query)

# OR
# Run an INSERT statement query (expects a table name and pandas DataFrame)
state, msg = sql_conn.insert_df(df, table)

# Close connection
state, msg = sql_conn.close_conn()
```

Run any one of the above commands and if the code can find the ODBC driver, it will connect.

**NOTE:** The `.query()` method returns a Pandas DataFrame 

### Self Debug
In the event of errors try the following:
1. Check, double check and check your connection details one more time.
1. If you're connecting from something other than a Microsoft Machine, you may need to use the last option since some MS Sql Server use instance name to have a discoverable port number, and non-Microsoft machines struggle to discover port number (sometimes)
1. If using FreeTDS on a non-Microsoft machine, make sure it is installed properly 

### TODO
- [x] allow for *writing* to MS SQL Server (if incomplete, only allows for read queries)
- [ ] improve ease of portability so that no effort (what-so-ever) is needed to accomodate operating system
- [ ] allow for non-Pandas DataFrame returns

### Fine Print
The main reason operating systems cause errors with connecting to MS SQL Server is due to the drivers and how a machine finds the drivers. For example, Windows can connect using an ODBC manager (so can MAC OSX, but not the easiest). Therefore, to make sure your deployment doesn't run with errors, use `os.name` to determine which OS is running and call the correct driver/use the appropriate connection details.
notify-discord 0.1
A simple python script to push notification on discord's channel using webhooks
Keywords: discord,webhook,notify

## notify-discord

### What ?

notify-discord is a simple python helper script to ease the post of messages on discord channels using webhooks.

### Requesite

you should how a discord server and create a webhook in one of its channels. The channel token will be necessary to use this script.

### Usage

```
notify-discord -m <message> -w <webhook>
```

### Example

```
notify-discord -m 'some useful message' -w '0000WEBHOOK0000/1111CHANNELTOKEN1111'
```

### caveats

Unknown.
identicallist 0.1.2
A mutable list that allows only identical objects and inherits their properties and methods.
Requires Python: >=3.3

# identicallist

A mutable Python list that allows only identical objects and inherits their properties and methods.

If a list property changes, it changes this property in all items.
If a list method is invoked, it invokes the method on all items.

## Examples

IdenticalList behaves just like a list:

```python
from identicallist import IdenticalList


class DummyItem:
    def __init__(self):
        self.num = 5

    def inc(self):
        self.num += 1

    def dec(self):
        self.num -= 1


il = IdenticalList(DummyItem(), DummyItem())
print(len(il)) # 2
print(iter(il)) # <generator object Sequence.__iter__ at 0x7fc3b708d5d0>
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 5
# item number 1 has the attribute num with value 5
```
At the same time, it also behaves like the first object of the list:
```python
print(il.num) # 5
il.inc()
print(il.num) # 6
```
Changing properties and calling methods on the list object affects all items in the list:
```python
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 6
# item number 1 has the attribute num with value 6
il.dec()
il.dec()
print(il.num) # 4
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 4
# item number 1 has the attribute num with value 4
il.num = 7
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 7
# item number 1 has the attribute num with value 7
```
Changing properties on individual items in the list only affect that item:
```python
il[1].num = 8
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 7
# item number 1 has the attribute num with value 8
il[0].dec()
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 6
# item number 1 has the attribute num with value 8
```
Now, calling inc on the list increases all item's num property. Note that because they started with different values, the resulting values are still different:
```python
il.inc()
for i, item in enumerate(il):
    print('item number {} has the attribute num with value {}'.format(i, item.num))
# item number 0 has the attribute num with value 7
# item number 1 has the attribute num with value 9
```