execsql2 2.31.1__py3-none-any.whl → 2.31.2__py3-none-any.whl
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.
- execsql/db/access.py +3 -1
- execsql/db/dsn.py +3 -0
- execsql/db/odbc.py +18 -1
- execsql/db/sqlserver.py +3 -1
- {execsql2-2.31.1.dist-info → execsql2-2.31.2.dist-info}/METADATA +2 -2
- {execsql2-2.31.1.dist-info → execsql2-2.31.2.dist-info}/RECORD +23 -23
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/README.md +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/config_settings.sqlite +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/example_config_prompt.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/make_config_db.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/md_compare.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/md_glossary.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/md_upsert.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/pg_compare.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/pg_glossary.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/script_template.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/ss_compare.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/ss_glossary.sql +0 -0
- {execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/ss_upsert.sql +0 -0
- {execsql2-2.31.1.dist-info → execsql2-2.31.2.dist-info}/WHEEL +0 -0
- {execsql2-2.31.1.dist-info → execsql2-2.31.2.dist-info}/entry_points.txt +0 -0
- {execsql2-2.31.1.dist-info → execsql2-2.31.2.dist-info}/licenses/LICENSE.txt +0 -0
- {execsql2-2.31.1.dist-info → execsql2-2.31.2.dist-info}/licenses/NOTICE +0 -0
execsql/db/access.py
CHANGED
|
@@ -15,7 +15,7 @@ from pathlib import Path
|
|
|
15
15
|
from typing import Any, cast
|
|
16
16
|
|
|
17
17
|
from execsql.db.base import Database, _fetched
|
|
18
|
-
from execsql.db.odbc import odbc_value
|
|
18
|
+
from execsql.db.odbc import fresh_sessions, odbc_value
|
|
19
19
|
from execsql.db.tiers import SupportTier
|
|
20
20
|
from execsql.exceptions import ErrInfo
|
|
21
21
|
from execsql.utils.errors import exception_desc, fatal_error, install_hint
|
|
@@ -108,6 +108,8 @@ class AccessDatabase(Database):
|
|
|
108
108
|
# Open an ODBC connection.
|
|
109
109
|
import pyodbc
|
|
110
110
|
|
|
111
|
+
fresh_sessions(pyodbc)
|
|
112
|
+
|
|
111
113
|
if self.conn is not None:
|
|
112
114
|
self.conn.close()
|
|
113
115
|
self.conn = None
|
execsql/db/dsn.py
CHANGED
|
@@ -10,6 +10,7 @@ the CLI.
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
from execsql.db.base import Database
|
|
13
|
+
from execsql.db.odbc import fresh_sessions
|
|
13
14
|
from execsql.db.tiers import SupportTier
|
|
14
15
|
from execsql.exceptions import ErrInfo
|
|
15
16
|
from execsql.utils.errors import exception_desc, fatal_error, install_hint
|
|
@@ -75,6 +76,8 @@ class DsnDatabase(Database):
|
|
|
75
76
|
# Open an ODBC connection using a DSN.
|
|
76
77
|
import pyodbc
|
|
77
78
|
|
|
79
|
+
fresh_sessions(pyodbc)
|
|
80
|
+
|
|
78
81
|
if self.conn is not None:
|
|
79
82
|
self.conn.close()
|
|
80
83
|
self.conn = None
|
execsql/db/odbc.py
CHANGED
|
@@ -7,15 +7,32 @@ taken from a substitution variable) would end its attribute early and
|
|
|
7
7
|
start another. :func:`odbc_value` brace-quotes such values;
|
|
8
8
|
:func:`connection_string` joins the attributes, and :func:`loggable`
|
|
9
9
|
gives the same string with the password masked for the log.
|
|
10
|
+
:func:`fresh_sessions` makes each pyodbc connection a new database session.
|
|
10
11
|
"""
|
|
11
12
|
|
|
12
13
|
from __future__ import annotations
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
__all__ = ["connection_string", "fresh_sessions", "loggable", "odbc_value"]
|
|
15
18
|
|
|
16
19
|
_SECRET_KEYS = frozenset({"pwd", "password"})
|
|
17
20
|
|
|
18
21
|
|
|
22
|
+
def fresh_sessions(pyodbc: Any) -> None:
|
|
23
|
+
"""Turn off pyodbc's connection pooling, so each connection is a new session.
|
|
24
|
+
|
|
25
|
+
With pooling on, closing a connection hands its session back to the ODBC
|
|
26
|
+
driver manager, and unixODBC gives it unchanged to the next connection to
|
|
27
|
+
the same server: temp tables and ``SET`` options from one ``CONNECT`` or
|
|
28
|
+
``execsql.run()`` were still there in the next. pyodbc applies the
|
|
29
|
+
setting when the process makes its first pyodbc connection, so it covers
|
|
30
|
+
every pyodbc connection in the process, and has no effect if one was
|
|
31
|
+
made before execsql's first.
|
|
32
|
+
"""
|
|
33
|
+
pyodbc.pooling = False
|
|
34
|
+
|
|
35
|
+
|
|
19
36
|
def odbc_value(value: object) -> str:
|
|
20
37
|
"""Return *value* as an ODBC attribute value, brace-quoted when it needs it.
|
|
21
38
|
|
execsql/db/sqlserver.py
CHANGED
|
@@ -8,7 +8,7 @@ Server via ``pyodbc``. Corresponds to ``-t s`` on the CLI.
|
|
|
8
8
|
"""
|
|
9
9
|
|
|
10
10
|
from execsql.db.base import Database
|
|
11
|
-
from execsql.db.odbc import connection_string, loggable
|
|
11
|
+
from execsql.db.odbc import connection_string, fresh_sessions, loggable
|
|
12
12
|
from execsql.exceptions import ErrInfo
|
|
13
13
|
from execsql.utils.errors import fatal_error, install_hint
|
|
14
14
|
from execsql.utils.auth import (
|
|
@@ -98,6 +98,8 @@ class SqlServerDatabase(Database):
|
|
|
98
98
|
"""Open a connection to the SQL Server database via pyodbc."""
|
|
99
99
|
import pyodbc
|
|
100
100
|
|
|
101
|
+
fresh_sessions(pyodbc)
|
|
102
|
+
|
|
101
103
|
if self.conn is None:
|
|
102
104
|
begin_login()
|
|
103
105
|
if self.user and self.need_passwd and not self.password:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: execsql2
|
|
3
|
-
Version: 2.31.
|
|
3
|
+
Version: 2.31.2
|
|
4
4
|
Summary: Runs a SQL script against a PostgreSQL, SQLite, MariaDB/MySQL, DuckDB, Firebird, MS-Access, MS-SQL-Server, or Oracle database, or an ODBC DSN. Provides metacommands to import and export data, copy data between databases, conditionally execute SQL and metacommands, and dynamically alter SQL and metacommands with substitution variables.
|
|
5
5
|
Project-URL: Homepage, https://execsql2.readthedocs.io/en/stable/
|
|
6
6
|
Project-URL: Repository, https://github.com/geocoug/execsql
|
|
@@ -441,7 +441,7 @@ execsql format --no-sql --in-place scripts/
|
|
|
441
441
|
```yaml
|
|
442
442
|
repos:
|
|
443
443
|
- repo: https://github.com/geocoug/execsql
|
|
444
|
-
rev: v2.31.
|
|
444
|
+
rev: v2.31.2
|
|
445
445
|
hooks:
|
|
446
446
|
- id: execsql-format
|
|
447
447
|
- id: execsql-lint
|
|
@@ -34,18 +34,18 @@ execsql/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
34
34
|
execsql/data/execsql.conf.template,sha256=Mz8wZxu0U2bfL-fsDpRHvdLkwNpfuZrl4QUMjp7SXyk,12770
|
|
35
35
|
execsql/data/script_header.sql,sha256=a7WKScekNgJoxVEmMRTkWv8NsAzW1jJ4vJfGy9HVy0g,349
|
|
36
36
|
execsql/db/__init__.py,sha256=jTbuafuKOqYtXFR1wvCOoKK5Lr3l1uErfaIbIr6UywI,1063
|
|
37
|
-
execsql/db/access.py,sha256=
|
|
37
|
+
execsql/db/access.py,sha256=fxiC3rtoOJzrNXNxau-w7oh1fd9tyh2_PMliBbFc164,21427
|
|
38
38
|
execsql/db/base.py,sha256=tBAcNRiYE7VZo98S75mu6Y2ySdBNoh8LzzTn7TgLOBs,43684
|
|
39
|
-
execsql/db/dsn.py,sha256=
|
|
39
|
+
execsql/db/dsn.py,sha256=Evrc6MUllJVFDn0jZB_iks-aKCsXuNF9XYjAkttqgGQ,6995
|
|
40
40
|
execsql/db/duckdb.py,sha256=KC8Tqbnemg3wsYH_efnFmxtybPbMXElFDsoeq_FeVus,11143
|
|
41
41
|
execsql/db/factory.py,sha256=Uz7Xcbff6ZZbtLM55FhHCwGdo4KKfqU_1kyjvOHn-HY,5691
|
|
42
42
|
execsql/db/firebird.py,sha256=CoNnzFtOFAkp8OJByXXXclitCPAAjM23eFJGfy3C7IE,10171
|
|
43
43
|
execsql/db/mysql.py,sha256=FVId78NifBmNfEI8zmqjRMJ3FUy7hskv411LqABAAOQ,24198
|
|
44
|
-
execsql/db/odbc.py,sha256=
|
|
44
|
+
execsql/db/odbc.py,sha256=l03UNHi8sFtjHbgOKUNA2teKOisNk-8laQGCsHZs2eo,2526
|
|
45
45
|
execsql/db/oracle.py,sha256=i5qPahsy_z1AuZT7l54Hzixknkvbzd-SCQgiVcTN94w,13796
|
|
46
46
|
execsql/db/postgres.py,sha256=sX2azdSt9N6jm_I47Zg8fukdYExGHRq_7XwVRZcfgAo,23647
|
|
47
47
|
execsql/db/sqlite.py,sha256=fEpNPkfJGnqm1Wx_rZK5SEqaWsBqLy85Jxk_5NsnqgM,12109
|
|
48
|
-
execsql/db/sqlserver.py,sha256=
|
|
48
|
+
execsql/db/sqlserver.py,sha256=6-wySx9BrSTAyXl5BnBLjRYEpl4_GubDjiGuvpehgco,10528
|
|
49
49
|
execsql/db/tiers.py,sha256=PH2sUYwlYqcANGVKXprWQKVIlM6fpWU9q74djn8oFwc,2924
|
|
50
50
|
execsql/debug/__init__.py,sha256=j6EGUR0dHzUhWN1mHHtf1-Lhjq3Sb1V-vmnq2Ztgj1M,178
|
|
51
51
|
execsql/debug/repl.py,sha256=jnwrqRac4krc1pES7Ni-j1Dyw3mJIcWl5LQQIX1GkRw,20753
|
|
@@ -135,22 +135,22 @@ execsql/utils/paths.py,sha256=7IIHT6vqXTfs6Ltfrzm_I2ZV4pU8IuedOLkHo6a1_K8,1175
|
|
|
135
135
|
execsql/utils/regex.py,sha256=DGzPBl0Kt4--RbwPhoZI6Bm6N_CBUvI0DbqE4EF6qp8,3718
|
|
136
136
|
execsql/utils/strings.py,sha256=UQNjpRCEFa1UO6feU-M-9e24wWAvizs_iu_4fFusLxo,8516
|
|
137
137
|
execsql/utils/timer.py,sha256=eDYf5VzCNFk7oo90InJucUm3XcBdhYMogjZMqeg9xzc,1899
|
|
138
|
-
execsql2-2.31.
|
|
139
|
-
execsql2-2.31.
|
|
140
|
-
execsql2-2.31.
|
|
141
|
-
execsql2-2.31.
|
|
142
|
-
execsql2-2.31.
|
|
143
|
-
execsql2-2.31.
|
|
144
|
-
execsql2-2.31.
|
|
145
|
-
execsql2-2.31.
|
|
146
|
-
execsql2-2.31.
|
|
147
|
-
execsql2-2.31.
|
|
148
|
-
execsql2-2.31.
|
|
149
|
-
execsql2-2.31.
|
|
150
|
-
execsql2-2.31.
|
|
151
|
-
execsql2-2.31.
|
|
152
|
-
execsql2-2.31.
|
|
153
|
-
execsql2-2.31.
|
|
154
|
-
execsql2-2.31.
|
|
155
|
-
execsql2-2.31.
|
|
156
|
-
execsql2-2.31.
|
|
138
|
+
execsql2-2.31.2.data/data/execsql2_extras/README.md,sha256=6f5bWiBlKRn8s6GVrU423-HFrU1Jwbk2AabxraLu3AY,5398
|
|
139
|
+
execsql2-2.31.2.data/data/execsql2_extras/config_settings.sqlite,sha256=aY5cxR7Q7J6zJ4bC9lu5mHUrhy211Cq3MNKPQVCt02E,20480
|
|
140
|
+
execsql2-2.31.2.data/data/execsql2_extras/example_config_prompt.sql,sha256=2e8KzzVWhho8KxYVHETSVmZdhW7wodioDsqBLSL6m4s,7487
|
|
141
|
+
execsql2-2.31.2.data/data/execsql2_extras/make_config_db.sql,sha256=WwyC6dK-Eh5CAVppiBCDHqiI1_wEI9U95Ytpr4lsZkg,8726
|
|
142
|
+
execsql2-2.31.2.data/data/execsql2_extras/md_compare.sql,sha256=ARYEcOlxWLxfw-KCKDeJRdCqnuCb9PVwGaHtITR2sYU,26535
|
|
143
|
+
execsql2-2.31.2.data/data/execsql2_extras/md_glossary.sql,sha256=gu2PDTm295YvxR7cDp25Mf-xXHly0BvlMudoNOrep5Q,10931
|
|
144
|
+
execsql2-2.31.2.data/data/execsql2_extras/md_upsert.sql,sha256=YNUTFS6yB4bZXs-wRDn6dN8jL5wIumzZyE2uo5arIos,113407
|
|
145
|
+
execsql2-2.31.2.data/data/execsql2_extras/pg_compare.sql,sha256=WcupGxQoWtMwHVPuy42xCpP4gAV4Ttb1W-_hwh-3xb4,24529
|
|
146
|
+
execsql2-2.31.2.data/data/execsql2_extras/pg_glossary.sql,sha256=CfQz2HZj2nMvJfYfQrAmNYdx0uRrOIWsCXwVo5gKv_k,9953
|
|
147
|
+
execsql2-2.31.2.data/data/execsql2_extras/script_template.sql,sha256=s5i0HULxp49N2Cpd24iALleM_dBq5oLuN3Arx_4Z7-o,11140
|
|
148
|
+
execsql2-2.31.2.data/data/execsql2_extras/ss_compare.sql,sha256=PpU-vPyqqC1faBoo5zwVZlZHYKkT79QZisWVlk4o-ss,26415
|
|
149
|
+
execsql2-2.31.2.data/data/execsql2_extras/ss_glossary.sql,sha256=_oTiZHpadPXWrNs8VoRe9PZgX9XdK490NMVWVTVtjl4,13110
|
|
150
|
+
execsql2-2.31.2.data/data/execsql2_extras/ss_upsert.sql,sha256=Dvst877h4KHn8ayYF9EXI_OxqLQ89wyfcnGYYT4szro,118304
|
|
151
|
+
execsql2-2.31.2.dist-info/METADATA,sha256=hcqYBQapidB4W3tZ0n4YWwdb6-j_8I4N6TrSyrHcrXY,26927
|
|
152
|
+
execsql2-2.31.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
153
|
+
execsql2-2.31.2.dist-info/entry_points.txt,sha256=jOf53-4IVGjEZeNYUOF1GGaiPNfVZcNKxP3vDFKEyMA,58
|
|
154
|
+
execsql2-2.31.2.dist-info/licenses/LICENSE.txt,sha256=LBdhuxejF8_bLCHZ2kWfmDXpDGUu914Gbd6_3JjCRe0,676
|
|
155
|
+
execsql2-2.31.2.dist-info/licenses/NOTICE,sha256=McYzgxYav3U1OaVsY4Su1sfBrfmplpRdA9b6-gCDQCg,342
|
|
156
|
+
execsql2-2.31.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{execsql2-2.31.1.data → execsql2-2.31.2.data}/data/execsql2_extras/example_config_prompt.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|