Metadata-Version: 2.1
Name: simplesqlitewrap
Version: 0.1.5
Summary: Simple util from which I inherit my sqlite classes
Home-page: UNKNOWN
Author: zeroone2numeral2
License: MIT
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database
Description-Content-Type: text/markdown

### Simple SQLite wrapper

Example:

```py
from simplesqlitewrap import Database

class DbWrapper(Database):
    def __init__(self, file_path):
        Database.__init__(self, file_path)

    def create_tables(self):
    	self._execute('CREATE TABLE IF NOT EXISTS Users (user_id INTEGER PRIMARY KEY, first_name NVARCHAR);')

    def insert_user(self, user_id, first_name):
    	# returns the number of inserted rows
    	return self._execute('INSERT OR IGNORE INTO Users VALUES (?, ?)', (user_id, first_name), rowcount=True)

    def select_users(self, **kwargs):
    	# returns the list of all the recors in 'Users' as classes
    	return self._execute('SELECT * FROM Users', **kwargs)

db = DbWrapper('database.sqlite')
print(db)

db.create_tables()

print(db.insert_user(1, 'Bob'))

users = db.select_users(as_obj=True)
for user in users:
	print('ID:', user.id, 'first name:', user.first_name)
```

