SQLDbWrpr 5.0.0__tar.gz → 5.0.1__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.
- {sqldbwrpr-5.0.0 → sqldbwrpr-5.0.1}/PKG-INFO +54 -1
- {sqldbwrpr-5.0.0 → sqldbwrpr-5.0.1}/README.md +53 -0
- {sqldbwrpr-5.0.0 → sqldbwrpr-5.0.1}/pyproject.toml +1 -1
- {sqldbwrpr-5.0.0 → sqldbwrpr-5.0.1}/LICENSE.txt +0 -0
- {sqldbwrpr-5.0.0 → sqldbwrpr-5.0.1}/src/sqldbwrpr/__init__.py +0 -0
- {sqldbwrpr-5.0.0 → sqldbwrpr-5.0.1}/src/sqldbwrpr/sqldbwrpr.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: SQLDbWrpr
|
|
3
|
-
Version: 5.0.
|
|
3
|
+
Version: 5.0.1
|
|
4
4
|
Summary: Wrapper for importing CSV and Text files into MySQL and Postgress
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE.txt
|
|
@@ -42,6 +42,59 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
|
|
43
43
|
## Overview
|
|
44
44
|
|
|
45
|
+
SqlDbWrpr is a Python-based utility designed to simplify interactions with SQL databases, specifically MySQL and MSSQL. It provides a high-level abstraction for common database operations, making it easier to manage database schemas, import/export data, and handle user permissions.
|
|
46
|
+
|
|
47
|
+
### Key Features
|
|
48
|
+
|
|
49
|
+
- **Schema Management**: Define your database structure (tables, fields, types, primary keys, foreign keys, and indexes) using a simple Python dictionary. SqlDbWrpr handles the creation of the database and tables based on this definition.
|
|
50
|
+
- **Data Import/Export**:
|
|
51
|
+
- Effortlessly import data from CSV files into your SQL tables. It supports both single and multi-volume CSV files and handles data type conversions and date formatting.
|
|
52
|
+
- Export table data or custom SQL query results back to CSV files, with options for multi-volume exports if the data size is large.
|
|
53
|
+
- **User and Permission Management**: Create and delete database users and grant them specific rights across the database.
|
|
54
|
+
- **SSL Support**: Secure your database connections with built-in support for SSL CA, key, and certificate files.
|
|
55
|
+
- **Batch Processing**: Optimize performance during data imports with configurable batch sizes.
|
|
56
|
+
- **Multi-Database Support**: Includes dedicated classes for MySQL and MSSQL, ensuring compatibility across different SQL environments.
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install SqlDbWrpr
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Quick Start
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from sqldbwrpr.sqldbwrpr import MySQL
|
|
68
|
+
|
|
69
|
+
# Define your database structure
|
|
70
|
+
db_structure = {
|
|
71
|
+
"Users": {
|
|
72
|
+
"ID": {
|
|
73
|
+
"Type": ["int"],
|
|
74
|
+
"Params": {"PrimaryKey": ["Y", "A"], "NN": "Y", "AI": "Y"},
|
|
75
|
+
},
|
|
76
|
+
"Username": {"Type": ["varchar", 50], "Params": {"NN": "Y"}},
|
|
77
|
+
"Email": {"Type": ["varchar", 100], "Params": {"NN": "Y"}},
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# Initialize the wrapper
|
|
82
|
+
db = MySQL(
|
|
83
|
+
p_host_name="localhost",
|
|
84
|
+
p_user_name="root",
|
|
85
|
+
p_password="yourpassword",
|
|
86
|
+
p_db_name="my_database",
|
|
87
|
+
p_db_structure=db_structure,
|
|
88
|
+
p_recreate_db=True,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# Import data from CSV
|
|
92
|
+
db.import_csv("Users", "users_data.csv")
|
|
93
|
+
|
|
94
|
+
# Export data to CSV
|
|
95
|
+
db.export_to_csv("exported_users.csv", "Users")
|
|
96
|
+
```
|
|
97
|
+
|
|
45
98
|
[cicd_codestyle_img]: https://img.shields.io/badge/code%20style-black-000000.svg "Black"
|
|
46
99
|
[cicd_codestyle_lnk]: https://github.com/psf/black "Black"
|
|
47
100
|
[cicd_pre_commit_img]: https://img.shields.io/github/actions/workflow/status/BrightEdgeeServices/SqlDbWrpr/pre-commit.yml?label=pre-commit "Pre-Commit"
|
|
@@ -9,6 +9,59 @@
|
|
|
9
9
|
|
|
10
10
|
## Overview
|
|
11
11
|
|
|
12
|
+
SqlDbWrpr is a Python-based utility designed to simplify interactions with SQL databases, specifically MySQL and MSSQL. It provides a high-level abstraction for common database operations, making it easier to manage database schemas, import/export data, and handle user permissions.
|
|
13
|
+
|
|
14
|
+
### Key Features
|
|
15
|
+
|
|
16
|
+
- **Schema Management**: Define your database structure (tables, fields, types, primary keys, foreign keys, and indexes) using a simple Python dictionary. SqlDbWrpr handles the creation of the database and tables based on this definition.
|
|
17
|
+
- **Data Import/Export**:
|
|
18
|
+
- Effortlessly import data from CSV files into your SQL tables. It supports both single and multi-volume CSV files and handles data type conversions and date formatting.
|
|
19
|
+
- Export table data or custom SQL query results back to CSV files, with options for multi-volume exports if the data size is large.
|
|
20
|
+
- **User and Permission Management**: Create and delete database users and grant them specific rights across the database.
|
|
21
|
+
- **SSL Support**: Secure your database connections with built-in support for SSL CA, key, and certificate files.
|
|
22
|
+
- **Batch Processing**: Optimize performance during data imports with configurable batch sizes.
|
|
23
|
+
- **Multi-Database Support**: Includes dedicated classes for MySQL and MSSQL, ensuring compatibility across different SQL environments.
|
|
24
|
+
|
|
25
|
+
### Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install SqlDbWrpr
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Quick Start
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from sqldbwrpr.sqldbwrpr import MySQL
|
|
35
|
+
|
|
36
|
+
# Define your database structure
|
|
37
|
+
db_structure = {
|
|
38
|
+
"Users": {
|
|
39
|
+
"ID": {
|
|
40
|
+
"Type": ["int"],
|
|
41
|
+
"Params": {"PrimaryKey": ["Y", "A"], "NN": "Y", "AI": "Y"},
|
|
42
|
+
},
|
|
43
|
+
"Username": {"Type": ["varchar", 50], "Params": {"NN": "Y"}},
|
|
44
|
+
"Email": {"Type": ["varchar", 100], "Params": {"NN": "Y"}},
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# Initialize the wrapper
|
|
49
|
+
db = MySQL(
|
|
50
|
+
p_host_name="localhost",
|
|
51
|
+
p_user_name="root",
|
|
52
|
+
p_password="yourpassword",
|
|
53
|
+
p_db_name="my_database",
|
|
54
|
+
p_db_structure=db_structure,
|
|
55
|
+
p_recreate_db=True,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Import data from CSV
|
|
59
|
+
db.import_csv("Users", "users_data.csv")
|
|
60
|
+
|
|
61
|
+
# Export data to CSV
|
|
62
|
+
db.export_to_csv("exported_users.csv", "Users")
|
|
63
|
+
```
|
|
64
|
+
|
|
12
65
|
[cicd_codestyle_img]: https://img.shields.io/badge/code%20style-black-000000.svg "Black"
|
|
13
66
|
[cicd_codestyle_lnk]: https://github.com/psf/black "Black"
|
|
14
67
|
[cicd_pre_commit_img]: https://img.shields.io/github/actions/workflow/status/BrightEdgeeServices/SqlDbWrpr/pre-commit.yml?label=pre-commit "Pre-Commit"
|
|
@@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = 'SQLDbWrpr'
|
|
9
|
-
version = '5.0.
|
|
9
|
+
version = '5.0.1'
|
|
10
10
|
description = 'Wrapper for importing CSV and Text files into MySQL and Postgress'
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "Hendrik du Toit", email = "hendrik@brightedge.co.za" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|