Rifqi Hafizuddin commited on
Commit ·
060c8cc
1
Parent(s): 6c87346
[NOTICKET][DB] fix mysql pipeline
Browse files
src/pipeline/db_pipeline/db_pipeline_service.py
CHANGED
|
@@ -63,8 +63,21 @@ class DbPipelineService:
|
|
| 63 |
port=credentials["port"],
|
| 64 |
database=credentials["database"],
|
| 65 |
)
|
| 66 |
-
# pymysql
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
return create_engine(url, connect_args=connect_args)
|
| 69 |
|
| 70 |
if db_type == "sqlserver":
|
|
|
|
| 63 |
port=credentials["port"],
|
| 64 |
database=credentials["database"],
|
| 65 |
)
|
| 66 |
+
# pymysql only activates TLS when the `ssl` dict is truthy
|
| 67 |
+
# (empty dict is falsy and silently disables TLS). Use system-
|
| 68 |
+
# default CAs via certifi + hostname verification — required by
|
| 69 |
+
# managed MySQL providers like TiDB Cloud / PlanetScale / Aiven.
|
| 70 |
+
if credentials.get("ssl", True):
|
| 71 |
+
import certifi
|
| 72 |
+
|
| 73 |
+
connect_args = {
|
| 74 |
+
"ssl": {
|
| 75 |
+
"ca": certifi.where(),
|
| 76 |
+
"check_hostname": True,
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
else:
|
| 80 |
+
connect_args = {}
|
| 81 |
return create_engine(url, connect_args=connect_args)
|
| 82 |
|
| 83 |
if db_type == "sqlserver":
|