Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
585 changes: 585 additions & 0 deletions docs/design/thread-safe-mode.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/datajoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"errors",
"migrate",
"DataJointError",
"ThreadSafetyError",
"logger",
"cli",
"ValidationResult",
Expand All @@ -73,7 +74,7 @@
)
from .blob import MatCell, MatStruct
from .connection import Connection, conn
from .errors import DataJointError
from .errors import DataJointError, ThreadSafetyError
from .expression import AndList, Not, Top, U
from .logging import logger
from .objectref import ObjectRef
Expand Down
6 changes: 0 additions & 6 deletions src/datajoint/adapters/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,28 @@ def connect(
Password for authentication.
**kwargs : Any
Additional MySQL-specific parameters:
- init_command: SQL initialization command
- ssl: TLS/SSL configuration dict (deprecated, use use_tls)
- use_tls: bool or dict - DataJoint's SSL parameter (preferred)
- charset: Character set (default from kwargs)

Returns
-------
pymysql.Connection
MySQL connection object.
"""
init_command = kwargs.get("init_command")
# Handle both ssl (old) and use_tls (new) parameter names
ssl_config = kwargs.get("use_tls", kwargs.get("ssl"))
# Convert boolean True to dict for PyMySQL (PyMySQL expects dict or SSLContext)
if ssl_config is True:
ssl_config = {} # Enable SSL with default settings
charset = kwargs.get("charset", "")

# Prepare connection parameters
conn_params = {
"host": host,
"port": port,
"user": user,
"passwd": password,
"init_command": init_command,
"sql_mode": "NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,"
"STRICT_ALL_TABLES,NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY",
"charset": charset,
"autocommit": True, # DataJoint manages transactions explicitly
}

Expand Down
Loading
Loading