SQLPyHelper 0.1.8__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/PKG-INFO +52 -18
  2. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/README.md +51 -17
  3. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/SQLPyHelper.egg-info/PKG-INFO +52 -18
  4. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/setup.py +1 -1
  5. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/__init__.py +1 -1
  6. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/async_helper.py +0 -1
  7. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/db_helper.py +1 -0
  8. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/LICENSE +0 -0
  9. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/SQLPyHelper.egg-info/SOURCES.txt +0 -0
  10. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/SQLPyHelper.egg-info/dependency_links.txt +0 -0
  11. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/SQLPyHelper.egg-info/entry_points.txt +0 -0
  12. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/SQLPyHelper.egg-info/requires.txt +0 -0
  13. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/SQLPyHelper.egg-info/top_level.txt +0 -0
  14. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/pyproject.toml +0 -0
  15. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/setup.cfg +0 -0
  16. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/automation_utils.py +0 -0
  17. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/cli.py +0 -0
  18. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/migration.py +0 -0
  19. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/sqlpyhelper/py.typed +0 -0
  20. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/test/test_async_helper.py +0 -0
  21. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/test/test_migration.py +0 -0
  22. {sqlpyhelper-0.1.8 → sqlpyhelper-0.1.9}/test/test_sqlpyhelper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SQLPyHelper
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A simple SQL database helper package for Python.
5
5
  Home-page: https://github.com/adebayopeter/sqlpyhelper
6
6
  Author: Adebayo Olaonipekun
@@ -101,6 +101,7 @@ with SQLPyHelper(db_type="postgres", host="localhost", user="user",
101
101
  - [MySQL Example](#mysql-example)
102
102
  - [SQL Server Example](#sql-server-example)
103
103
  - [Oracle Example](#oracle-example)
104
+ - [Async Example (FastAPI / asyncio)](#async-example-fastapi--asyncio)
104
105
  - [📂 Project Structure](#-project-structure)
105
106
  - [📌 Available Methods in SQLPyHelper](#-available-methods-in-sqlpyhelper)
106
107
  - [🌍 Contributing](#-contributing)
@@ -108,14 +109,16 @@ with SQLPyHelper(db_type="postgres", host="localhost", user="user",
108
109
 
109
110
  ---
110
111
 
111
- ## 🚀 Features in v0.1.4
112
- - Unified connection pooling for multiple databases.
113
- - Automatic reconnection for lost connections.
114
- - Transaction support (BEGIN, ROLLBACK, COMMIT).
115
- - Secure parameterized queries to prevent SQL injection.
116
- - Bulk insertion & dynamic table creation.
117
- - Logging & error handling for better debugging.
112
+ ## 🚀 Features in v0.1.8
113
+ - Unified connection pooling for multiple databases.
114
+ - Automatic reconnection for lost connections.
115
+ - Transaction support (BEGIN, ROLLBACK, COMMIT).
116
+ - Secure parameterized queries to prevent SQL injection.
117
+ - Bulk insertion & dynamic table creation.
118
+ - Logging & error handling for better debugging.
118
119
  - CSV export & database backups.
120
+ - **Cross-database migration** — copy tables between any two supported databases.
121
+ - **Async support** — `AsyncSQLPyHelper` for FastAPI and asyncio applications.
119
122
 
120
123
  ---
121
124
  ## 📦 Installation
@@ -214,20 +217,50 @@ db.setup_connection_pool(min_conn=2, max_conn=10) # Enable pooling for better p
214
217
  conn = db.get_connection_from_pool()
215
218
  db.return_connection_to_pool(conn)
216
219
  ```
220
+ ### Async Example (FastAPI / asyncio)
221
+ ```python
222
+ import asyncio
223
+ from sqlpyhelper.async_helper import AsyncSQLPyHelper
224
+
225
+ async def main():
226
+ async with AsyncSQLPyHelper(db_type="sqlite", database="my.db") as db:
227
+ await db.execute(
228
+ "CREATE TABLE IF NOT EXISTS users (id INTEGER, name TEXT)"
229
+ )
230
+ await db.execute(
231
+ "INSERT INTO users VALUES ($1, $2)", 1, "Alice"
232
+ )
233
+ rows = await db.fetch_all("SELECT * FROM users")
234
+ print(rows)
235
+
236
+ asyncio.run(main())
237
+ ```
217
238
 
218
239
  ## 📂 Project Structure
219
240
  ```
220
241
  📦 SQLPyHelper/
221
- ├─ sqlpyhelper/
222
-   ├─ __init__.py
223
-   └─ db_helper.py
224
- ├─ tests/
225
-   └─ test_sqlpyhelper.py
226
- ├─ .env_example
227
- ├─ .gitignore
228
- ├─ setup.py
229
- ├─ README.md
230
- └─ requirements.txt
242
+ ├─ sqlpyhelper/
243
+ ├─ __init__.py
244
+ ├─ db_helper.py
245
+ ├─ async_helper.py
246
+ ├─ automation_utils.py
247
+ ├─ cli.py
248
+ │ └─ migration.py
249
+ ├─ test/
250
+ ├─ test_sqlpyhelper.py
251
+ │ ├─ test_async_helper.py
252
+ │ └─ test_migration.py
253
+ ├─ docs/
254
+ ├─ .env_example
255
+ ├─ .gitignore
256
+ ├─ setup.py
257
+ ├─ setup.cfg
258
+ ├─ pyproject.toml
259
+ ├─ CHANGELOG.md
260
+ ├─ CONTRIBUTING.md
261
+ ├─ pre-commit.sh
262
+ ├─ README.md
263
+ └─ requirements.txt
231
264
  ```
232
265
  ---
233
266
  ## 📌 Available Methods in SQLPyHelper
@@ -249,6 +282,7 @@ db.return_connection_to_pool(conn)
249
282
  | `commit_transaction()` | Commits the current transaction. |
250
283
  | `close()` | Closes the database connection safely. |
251
284
  | `__enter__` / `__exit__()` | Use as a context manager — connection closes automatically. |
285
+ | `AsyncSQLPyHelper` | Async-native class for FastAPI/asyncio — see [Async docs](https://sqlpyhelper.readthedocs.io/en/latest/async.html). |
252
286
 
253
287
  ---
254
288
  ## 🌍 Contributing
@@ -29,6 +29,7 @@ with SQLPyHelper(db_type="postgres", host="localhost", user="user",
29
29
  - [MySQL Example](#mysql-example)
30
30
  - [SQL Server Example](#sql-server-example)
31
31
  - [Oracle Example](#oracle-example)
32
+ - [Async Example (FastAPI / asyncio)](#async-example-fastapi--asyncio)
32
33
  - [📂 Project Structure](#-project-structure)
33
34
  - [📌 Available Methods in SQLPyHelper](#-available-methods-in-sqlpyhelper)
34
35
  - [🌍 Contributing](#-contributing)
@@ -36,14 +37,16 @@ with SQLPyHelper(db_type="postgres", host="localhost", user="user",
36
37
 
37
38
  ---
38
39
 
39
- ## 🚀 Features in v0.1.4
40
- - Unified connection pooling for multiple databases.
41
- - Automatic reconnection for lost connections.
42
- - Transaction support (BEGIN, ROLLBACK, COMMIT).
43
- - Secure parameterized queries to prevent SQL injection.
44
- - Bulk insertion & dynamic table creation.
45
- - Logging & error handling for better debugging.
40
+ ## 🚀 Features in v0.1.8
41
+ - Unified connection pooling for multiple databases.
42
+ - Automatic reconnection for lost connections.
43
+ - Transaction support (BEGIN, ROLLBACK, COMMIT).
44
+ - Secure parameterized queries to prevent SQL injection.
45
+ - Bulk insertion & dynamic table creation.
46
+ - Logging & error handling for better debugging.
46
47
  - CSV export & database backups.
48
+ - **Cross-database migration** — copy tables between any two supported databases.
49
+ - **Async support** — `AsyncSQLPyHelper` for FastAPI and asyncio applications.
47
50
 
48
51
  ---
49
52
  ## 📦 Installation
@@ -142,20 +145,50 @@ db.setup_connection_pool(min_conn=2, max_conn=10) # Enable pooling for better p
142
145
  conn = db.get_connection_from_pool()
143
146
  db.return_connection_to_pool(conn)
144
147
  ```
148
+ ### Async Example (FastAPI / asyncio)
149
+ ```python
150
+ import asyncio
151
+ from sqlpyhelper.async_helper import AsyncSQLPyHelper
152
+
153
+ async def main():
154
+ async with AsyncSQLPyHelper(db_type="sqlite", database="my.db") as db:
155
+ await db.execute(
156
+ "CREATE TABLE IF NOT EXISTS users (id INTEGER, name TEXT)"
157
+ )
158
+ await db.execute(
159
+ "INSERT INTO users VALUES ($1, $2)", 1, "Alice"
160
+ )
161
+ rows = await db.fetch_all("SELECT * FROM users")
162
+ print(rows)
163
+
164
+ asyncio.run(main())
165
+ ```
145
166
 
146
167
  ## 📂 Project Structure
147
168
  ```
148
169
  📦 SQLPyHelper/
149
- ├─ sqlpyhelper/
150
-   ├─ __init__.py
151
-   └─ db_helper.py
152
- ├─ tests/
153
-   └─ test_sqlpyhelper.py
154
- ├─ .env_example
155
- ├─ .gitignore
156
- ├─ setup.py
157
- ├─ README.md
158
- └─ requirements.txt
170
+ ├─ sqlpyhelper/
171
+ ├─ __init__.py
172
+ ├─ db_helper.py
173
+ ├─ async_helper.py
174
+ ├─ automation_utils.py
175
+ ├─ cli.py
176
+ │ └─ migration.py
177
+ ├─ test/
178
+ ├─ test_sqlpyhelper.py
179
+ │ ├─ test_async_helper.py
180
+ │ └─ test_migration.py
181
+ ├─ docs/
182
+ ├─ .env_example
183
+ ├─ .gitignore
184
+ ├─ setup.py
185
+ ├─ setup.cfg
186
+ ├─ pyproject.toml
187
+ ├─ CHANGELOG.md
188
+ ├─ CONTRIBUTING.md
189
+ ├─ pre-commit.sh
190
+ ├─ README.md
191
+ └─ requirements.txt
159
192
  ```
160
193
  ---
161
194
  ## 📌 Available Methods in SQLPyHelper
@@ -177,6 +210,7 @@ db.return_connection_to_pool(conn)
177
210
  | `commit_transaction()` | Commits the current transaction. |
178
211
  | `close()` | Closes the database connection safely. |
179
212
  | `__enter__` / `__exit__()` | Use as a context manager — connection closes automatically. |
213
+ | `AsyncSQLPyHelper` | Async-native class for FastAPI/asyncio — see [Async docs](https://sqlpyhelper.readthedocs.io/en/latest/async.html). |
180
214
 
181
215
  ---
182
216
  ## 🌍 Contributing
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SQLPyHelper
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A simple SQL database helper package for Python.
5
5
  Home-page: https://github.com/adebayopeter/sqlpyhelper
6
6
  Author: Adebayo Olaonipekun
@@ -101,6 +101,7 @@ with SQLPyHelper(db_type="postgres", host="localhost", user="user",
101
101
  - [MySQL Example](#mysql-example)
102
102
  - [SQL Server Example](#sql-server-example)
103
103
  - [Oracle Example](#oracle-example)
104
+ - [Async Example (FastAPI / asyncio)](#async-example-fastapi--asyncio)
104
105
  - [📂 Project Structure](#-project-structure)
105
106
  - [📌 Available Methods in SQLPyHelper](#-available-methods-in-sqlpyhelper)
106
107
  - [🌍 Contributing](#-contributing)
@@ -108,14 +109,16 @@ with SQLPyHelper(db_type="postgres", host="localhost", user="user",
108
109
 
109
110
  ---
110
111
 
111
- ## 🚀 Features in v0.1.4
112
- - Unified connection pooling for multiple databases.
113
- - Automatic reconnection for lost connections.
114
- - Transaction support (BEGIN, ROLLBACK, COMMIT).
115
- - Secure parameterized queries to prevent SQL injection.
116
- - Bulk insertion & dynamic table creation.
117
- - Logging & error handling for better debugging.
112
+ ## 🚀 Features in v0.1.8
113
+ - Unified connection pooling for multiple databases.
114
+ - Automatic reconnection for lost connections.
115
+ - Transaction support (BEGIN, ROLLBACK, COMMIT).
116
+ - Secure parameterized queries to prevent SQL injection.
117
+ - Bulk insertion & dynamic table creation.
118
+ - Logging & error handling for better debugging.
118
119
  - CSV export & database backups.
120
+ - **Cross-database migration** — copy tables between any two supported databases.
121
+ - **Async support** — `AsyncSQLPyHelper` for FastAPI and asyncio applications.
119
122
 
120
123
  ---
121
124
  ## 📦 Installation
@@ -214,20 +217,50 @@ db.setup_connection_pool(min_conn=2, max_conn=10) # Enable pooling for better p
214
217
  conn = db.get_connection_from_pool()
215
218
  db.return_connection_to_pool(conn)
216
219
  ```
220
+ ### Async Example (FastAPI / asyncio)
221
+ ```python
222
+ import asyncio
223
+ from sqlpyhelper.async_helper import AsyncSQLPyHelper
224
+
225
+ async def main():
226
+ async with AsyncSQLPyHelper(db_type="sqlite", database="my.db") as db:
227
+ await db.execute(
228
+ "CREATE TABLE IF NOT EXISTS users (id INTEGER, name TEXT)"
229
+ )
230
+ await db.execute(
231
+ "INSERT INTO users VALUES ($1, $2)", 1, "Alice"
232
+ )
233
+ rows = await db.fetch_all("SELECT * FROM users")
234
+ print(rows)
235
+
236
+ asyncio.run(main())
237
+ ```
217
238
 
218
239
  ## 📂 Project Structure
219
240
  ```
220
241
  📦 SQLPyHelper/
221
- ├─ sqlpyhelper/
222
-   ├─ __init__.py
223
-   └─ db_helper.py
224
- ├─ tests/
225
-   └─ test_sqlpyhelper.py
226
- ├─ .env_example
227
- ├─ .gitignore
228
- ├─ setup.py
229
- ├─ README.md
230
- └─ requirements.txt
242
+ ├─ sqlpyhelper/
243
+ ├─ __init__.py
244
+ ├─ db_helper.py
245
+ ├─ async_helper.py
246
+ ├─ automation_utils.py
247
+ ├─ cli.py
248
+ │ └─ migration.py
249
+ ├─ test/
250
+ ├─ test_sqlpyhelper.py
251
+ │ ├─ test_async_helper.py
252
+ │ └─ test_migration.py
253
+ ├─ docs/
254
+ ├─ .env_example
255
+ ├─ .gitignore
256
+ ├─ setup.py
257
+ ├─ setup.cfg
258
+ ├─ pyproject.toml
259
+ ├─ CHANGELOG.md
260
+ ├─ CONTRIBUTING.md
261
+ ├─ pre-commit.sh
262
+ ├─ README.md
263
+ └─ requirements.txt
231
264
  ```
232
265
  ---
233
266
  ## 📌 Available Methods in SQLPyHelper
@@ -249,6 +282,7 @@ db.return_connection_to_pool(conn)
249
282
  | `commit_transaction()` | Commits the current transaction. |
250
283
  | `close()` | Closes the database connection safely. |
251
284
  | `__enter__` / `__exit__()` | Use as a context manager — connection closes automatically. |
285
+ | `AsyncSQLPyHelper` | Async-native class for FastAPI/asyncio — see [Async docs](https://sqlpyhelper.readthedocs.io/en/latest/async.html). |
252
286
 
253
287
  ---
254
288
  ## 🌍 Contributing
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name='SQLPyHelper',
8
- version='0.1.8',
8
+ version='0.1.9',
9
9
  description='A simple SQL database helper package for Python.',
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
@@ -1,5 +1,5 @@
1
1
  # Match the version in setup.py
2
- __version__ = "0.1.8"
2
+ __version__ = "0.1.9"
3
3
 
4
4
  from sqlpyhelper.async_helper import ( # noqa: F401
5
5
  AsyncConnectionError,
@@ -105,7 +105,6 @@ class AsyncSQLPyHelper:
105
105
  import aiosqlite
106
106
 
107
107
  self._connection = await aiosqlite.connect(self.database or "") # type: ignore[arg-type]
108
- self._connection.row_factory = aiosqlite.Row
109
108
  logger.info("Connected to SQLite database: %s", self.database)
110
109
 
111
110
  elif self.db_type == "postgres":
@@ -96,6 +96,7 @@ class SQLPyHelper:
96
96
  user=self.user,
97
97
  password=self.password,
98
98
  dbname=self.database,
99
+ port=self.port,
99
100
  )
100
101
  elif self.db_type == "mysql":
101
102
  import mysql.connector
File without changes
File without changes
File without changes