pymnemon 0.1.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.
pymnemon-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The pymnemon contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-exclude build *
4
+ recursive-exclude dist *
5
+ recursive-exclude *.egg-info *
6
+ recursive-exclude __pycache__ *
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: pymnemon
3
+ Version: 0.1.1
4
+ Summary: Unified db connector system with normalized error handling across multiple databases.
5
+ Author-email: Causum <support@causum.com>
6
+ Maintainer-email: Causum <support@causum.com>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 The pymnemon contributors
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Repository, https://gitlab.com/causum/mnemon
30
+ Requires-Python: >=3.9
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: SQLAlchemy==2.0.45
34
+ Requires-Dist: psycopg2-binary
35
+ Requires-Dist: sqlalchemy-bigquery
36
+ Requires-Dist: google-cloud-bigquery
37
+ Requires-Dist: redshift-connector
38
+ Requires-Dist: clickhouse-driver
39
+ Requires-Dist: clickhouse-sqlalchemy>=0.3
40
+ Requires-Dist: duckdb
41
+ Requires-Dist: PyMySQL
42
+ Requires-Dist: pyodbc
43
+ Requires-Dist: databricks-sql-connector>=3.0
44
+ Requires-Dist: trino
45
+ Requires-Dist: PyHive
46
+ Requires-Dist: vertica-python
47
+ Requires-Dist: oracledb
48
+ Requires-Dist: teradatasql
49
+ Requires-Dist: ibm-db
50
+ Requires-Dist: ibm-db-sa
51
+ Requires-Dist: snowflake-sqlalchemy
52
+ Requires-Dist: google-cloud-bigquery-storage
53
+ Requires-Dist: PyAthena[SQLAlchemy]
54
+ Dynamic: license-file
55
+
56
+ # pymnemon
57
+
58
+ Unified SQLAlchemy connector with normalized error handling across multiple databases.
59
+
60
+ Note: The PyPI package name is `pymnemon`, but the import name is `mnemon`.
61
+
62
+ ## Install
63
+
64
+ ```bash
65
+ pip install pymnemon
66
+ ```
67
+
68
+ ## Quickstart
69
+
70
+ ```python
71
+ from mnemon import SchemaDBConnection
72
+
73
+ config = {
74
+ "database_type": "postgresql",
75
+ "auth_method": "password",
76
+ "connection": {
77
+ "user": "dbuser",
78
+ "password": "dbpass",
79
+ "host": "localhost",
80
+ "port": 5432,
81
+ "database": "analytics",
82
+ # optional
83
+ # "sslmode": "require",
84
+ },
85
+ }
86
+
87
+ with SchemaDBConnection(config) as db:
88
+ ok, engine, error = db.safe_connect()
89
+ if not ok:
90
+ print(error)
91
+ else:
92
+ rows = db.execute_query("SELECT 1 AS ok")
93
+ print(rows)
94
+ ```
95
+
96
+ ## Configuration
97
+
98
+ `SchemaDBConnection` expects a config dict with this shape:
99
+
100
+ ```python
101
+ {
102
+ "database_type": "<supported database>",
103
+ "auth_method": "<supported auth method>",
104
+ "connection": { ... database-specific fields ... }
105
+ }
106
+ ```
107
+
108
+ Supported databases and auth methods:
109
+
110
+ - postgresql: password, scram, ssl_verify, ssl_cert
111
+ - mysql: password, ssl_verify, ssl_cert
112
+ - mariadb: password, ssl_verify, ssl_cert
113
+ - clickhouse: password, ssl_verify, ssl_cert
114
+ - sqlserver: password
115
+ - trino: none, password, jwt, certificate
116
+ - sparksql: none, password, ldap
117
+ - vertica: password, ldap, ssl_verify
118
+ - oracle: password, wallet
119
+ - teradata: password, ldap
120
+ - db2: password, ldap
121
+ - snowflake: password, key_pair
122
+ - bigquery: service_account
123
+ - redshift: password, iam_role
124
+ - duckdb: local_file, motherduck
125
+ - databricks: token, oauth_m2m
126
+ - athena: iam_credentials
127
+
128
+ ### Example configs
129
+
130
+ PostgreSQL (password):
131
+
132
+ ```python
133
+ {
134
+ "database_type": "postgresql",
135
+ "auth_method": "password",
136
+ "connection": {
137
+ "user": "dbuser",
138
+ "password": "dbpass",
139
+ "host": "localhost",
140
+ "port": 5432,
141
+ "database": "analytics"
142
+ }
143
+ }
144
+ ```
145
+
146
+ Snowflake (key pair):
147
+
148
+ ```python
149
+ {
150
+ "database_type": "snowflake",
151
+ "auth_method": "key_pair",
152
+ "connection": {
153
+ "account": "xy12345.us-east-1",
154
+ "user": "DBUSER",
155
+ "warehouse": "COMPUTE_WH",
156
+ "database": "ANALYTICS",
157
+ "schema": "PUBLIC",
158
+ "private_key": {"content": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"},
159
+ "private_key_passphrase": "optional"
160
+ }
161
+ }
162
+ ```
163
+
164
+ BigQuery (service account):
165
+
166
+ ```python
167
+ {
168
+ "database_type": "bigquery",
169
+ "auth_method": "service_account",
170
+ "connection": {
171
+ "project": "my-gcp-project",
172
+ "dataset": "analytics",
173
+ "location": "US",
174
+ "credentials_json": {"content": "{... service account json ...}"}
175
+ }
176
+ }
177
+ ```
178
+
179
+ Databricks (PAT):
180
+
181
+ ```python
182
+ {
183
+ "database_type": "databricks",
184
+ "auth_method": "token",
185
+ "connection": {
186
+ "host": "adb-1234567890.12.azuredatabricks.net",
187
+ "http_path": "/sql/1.0/warehouses/abcd1234",
188
+ "access_token": "dapi..."
189
+ }
190
+ }
191
+ ```
192
+
193
+ ## Error handling
194
+
195
+ `safe_connect()` returns `(success, engine, error)` where `error` is a normalized JSON payload with:
196
+
197
+ ```json
198
+ {
199
+ "success": false,
200
+ "error": {
201
+ "category": "auth_failed",
202
+ "message": "Authentication failed. Please check your credentials.",
203
+ "next_steps": ["Verify username and password"],
204
+ "field_hint": "user or password",
205
+ "details": "... original error ..."
206
+ }
207
+ }
208
+ ```
209
+
210
+ ## Notes on dependencies
211
+
212
+ Some drivers require system dependencies or extra setup:
213
+
214
+ - `pyodbc` for SQL Server requires an ODBC driver (e.g., ODBC Driver 18).
215
+ - `oracledb` may require Oracle client configuration depending on mode.
216
+ - `PyAthena[SQLAlchemy]` is used for Athena SQLAlchemy dialect support.
217
+
218
+ ## License
219
+
220
+ MIT
@@ -0,0 +1,165 @@
1
+ # pymnemon
2
+
3
+ Unified SQLAlchemy connector with normalized error handling across multiple databases.
4
+
5
+ Note: The PyPI package name is `pymnemon`, but the import name is `mnemon`.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install pymnemon
11
+ ```
12
+
13
+ ## Quickstart
14
+
15
+ ```python
16
+ from mnemon import SchemaDBConnection
17
+
18
+ config = {
19
+ "database_type": "postgresql",
20
+ "auth_method": "password",
21
+ "connection": {
22
+ "user": "dbuser",
23
+ "password": "dbpass",
24
+ "host": "localhost",
25
+ "port": 5432,
26
+ "database": "analytics",
27
+ # optional
28
+ # "sslmode": "require",
29
+ },
30
+ }
31
+
32
+ with SchemaDBConnection(config) as db:
33
+ ok, engine, error = db.safe_connect()
34
+ if not ok:
35
+ print(error)
36
+ else:
37
+ rows = db.execute_query("SELECT 1 AS ok")
38
+ print(rows)
39
+ ```
40
+
41
+ ## Configuration
42
+
43
+ `SchemaDBConnection` expects a config dict with this shape:
44
+
45
+ ```python
46
+ {
47
+ "database_type": "<supported database>",
48
+ "auth_method": "<supported auth method>",
49
+ "connection": { ... database-specific fields ... }
50
+ }
51
+ ```
52
+
53
+ Supported databases and auth methods:
54
+
55
+ - postgresql: password, scram, ssl_verify, ssl_cert
56
+ - mysql: password, ssl_verify, ssl_cert
57
+ - mariadb: password, ssl_verify, ssl_cert
58
+ - clickhouse: password, ssl_verify, ssl_cert
59
+ - sqlserver: password
60
+ - trino: none, password, jwt, certificate
61
+ - sparksql: none, password, ldap
62
+ - vertica: password, ldap, ssl_verify
63
+ - oracle: password, wallet
64
+ - teradata: password, ldap
65
+ - db2: password, ldap
66
+ - snowflake: password, key_pair
67
+ - bigquery: service_account
68
+ - redshift: password, iam_role
69
+ - duckdb: local_file, motherduck
70
+ - databricks: token, oauth_m2m
71
+ - athena: iam_credentials
72
+
73
+ ### Example configs
74
+
75
+ PostgreSQL (password):
76
+
77
+ ```python
78
+ {
79
+ "database_type": "postgresql",
80
+ "auth_method": "password",
81
+ "connection": {
82
+ "user": "dbuser",
83
+ "password": "dbpass",
84
+ "host": "localhost",
85
+ "port": 5432,
86
+ "database": "analytics"
87
+ }
88
+ }
89
+ ```
90
+
91
+ Snowflake (key pair):
92
+
93
+ ```python
94
+ {
95
+ "database_type": "snowflake",
96
+ "auth_method": "key_pair",
97
+ "connection": {
98
+ "account": "xy12345.us-east-1",
99
+ "user": "DBUSER",
100
+ "warehouse": "COMPUTE_WH",
101
+ "database": "ANALYTICS",
102
+ "schema": "PUBLIC",
103
+ "private_key": {"content": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"},
104
+ "private_key_passphrase": "optional"
105
+ }
106
+ }
107
+ ```
108
+
109
+ BigQuery (service account):
110
+
111
+ ```python
112
+ {
113
+ "database_type": "bigquery",
114
+ "auth_method": "service_account",
115
+ "connection": {
116
+ "project": "my-gcp-project",
117
+ "dataset": "analytics",
118
+ "location": "US",
119
+ "credentials_json": {"content": "{... service account json ...}"}
120
+ }
121
+ }
122
+ ```
123
+
124
+ Databricks (PAT):
125
+
126
+ ```python
127
+ {
128
+ "database_type": "databricks",
129
+ "auth_method": "token",
130
+ "connection": {
131
+ "host": "adb-1234567890.12.azuredatabricks.net",
132
+ "http_path": "/sql/1.0/warehouses/abcd1234",
133
+ "access_token": "dapi..."
134
+ }
135
+ }
136
+ ```
137
+
138
+ ## Error handling
139
+
140
+ `safe_connect()` returns `(success, engine, error)` where `error` is a normalized JSON payload with:
141
+
142
+ ```json
143
+ {
144
+ "success": false,
145
+ "error": {
146
+ "category": "auth_failed",
147
+ "message": "Authentication failed. Please check your credentials.",
148
+ "next_steps": ["Verify username and password"],
149
+ "field_hint": "user or password",
150
+ "details": "... original error ..."
151
+ }
152
+ }
153
+ ```
154
+
155
+ ## Notes on dependencies
156
+
157
+ Some drivers require system dependencies or extra setup:
158
+
159
+ - `pyodbc` for SQL Server requires an ODBC driver (e.g., ODBC Driver 18).
160
+ - `oracledb` may require Oracle client configuration depending on mode.
161
+ - `PyAthena[SQLAlchemy]` is used for Athena SQLAlchemy dialect support.
162
+
163
+ ## License
164
+
165
+ MIT
@@ -0,0 +1,66 @@
1
+ [build-system]
2
+ requires = ["setuptools>=67", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pymnemon"
7
+ version = "0.1.1"
8
+ description = "Unified db connector system with normalized error handling across multiple databases."
9
+ readme = "README.md"
10
+ license = {file = "LICENSE"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "Causum", email = "support@causum.com"},
14
+ ]
15
+ maintainers = [
16
+ {name = "Causum", email = "support@causum.com"},
17
+ ]
18
+ urls = {Repository = "https://gitlab.com/causum/mnemon"}
19
+ dependencies = [
20
+ "SQLAlchemy==2.0.45",
21
+
22
+ # postgres
23
+ "psycopg2-binary",
24
+ # bigquery
25
+ "sqlalchemy-bigquery",
26
+ "google-cloud-bigquery",
27
+ # redshift
28
+ "redshift-connector",
29
+ # clickhouse
30
+ "clickhouse-driver",
31
+ "clickhouse-sqlalchemy>=0.3",
32
+ # duckdb
33
+ "duckdb",
34
+ # mysql
35
+ "PyMySQL",
36
+ # sqlserver
37
+ "pyodbc",
38
+ # databricks (NO sqlalchemy wrapper)
39
+ "databricks-sql-connector>=3.0",
40
+ # trino
41
+ "trino",
42
+ # hive
43
+ "PyHive",
44
+ # vertica
45
+ "vertica-python",
46
+ # oracle
47
+ "oracledb",
48
+ # teradata
49
+ "teradatasql",
50
+ # db2
51
+ "ibm-db",
52
+ "ibm-db-sa",
53
+ # snowflake
54
+ "snowflake-sqlalchemy",
55
+ # bigquery
56
+ "google-cloud-bigquery-storage",
57
+ # athena
58
+ "PyAthena[SQLAlchemy]",
59
+ ]
60
+
61
+ [tool.setuptools]
62
+ package-dir = {"" = "src"}
63
+
64
+ [tool.setuptools.packages.find]
65
+ where = ["src"]
66
+ include = ["mnemon*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ """
2
+ mnemon
3
+ ------
4
+
5
+ Public entrypoint for the SchemaDBConnection helper.
6
+ """
7
+
8
+ from .db_connect import SchemaDBConnection
9
+
10
+ __all__ = ["SchemaDBConnection"]