Metadata-Version: 2.4
Name: RenesSQLiteHelper
Version: 0.2.0
Summary: René's minimal wrapper around Python's sqlite3 module
Author: René Nyffenegger
License-Expression: MIT
Project-URL: Repository, https://github.com/ReneNyffenegger/py-RenesSQLiteHelper
Project-URL: Homepage, https://renenyffenegger.ch/notes/development/languages/Python/standard-library/sqlite3/RenesSQLiteHelper
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Dynamic: license-file

# RenesSQLiteHelper

René's minimal wrapper around Python's built-in `sqlite3` module.

## Installation

```bash
pip install RenesSQLiteHelper
```

## Usage

### Create a database

The database file (Here: `some-data`) is stored by default under `~/.local/share/sqlite-dbs`.

```python
from RenesSQLiteHelper import open_db, bulk_load
con = open_db('some-data', deleteIfExists = True)

con.execute('''
create table tab (
   id  integer primary key,
   val text
)
''')
```

### Use the database

Bulk load
```python
con = open_db('some-data')

with bulk_load(con) as cur:
    cur.execute('insert into tab values (?, ?)', (42, 'hello world'))
```

Selecting etc
```python
for rec in con.execute('select * from tab'):
    print(f'{rec['id']}: {rec['val']}')
```
