This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SQLObject development repository".
The branch, mssql has been created
at 0ab2d1d6ae3f50a15f234386b6185ed968d3bd72 (commit)
- Log -----------------------------------------------------------------
http://sourceforge.net/p/sqlobject/sqlobject/ci/0ab2d1d6ae3f50a15f234386b6185ed968d3bd72
commit 0ab2d1d6ae3f50a15f234386b6185ed968d3bd72
Author: Oleg Broytman <ph...@ph...>
Date: Fri Dec 2 19:21:45 2022 +0300
WIP: Tests(MSSQL): Run only two test files; set timeout
diff --git a/tox.ini b/tox.ini
index fcf70dd..d53fbc3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -620,7 +620,7 @@ platform = win32
commands =
-sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "CREATE DATABASE sqlobject_test"
- pytest -D "mssql://SA:YourStrong!Passw0rd@localhost:1433/sqlobject_test?driver=pymssql&debug=1"
+ pytest -D "mssql://SA:YourStrong!Passw0rd@localhost:1433/sqlobject_test?driver=pymssql&debug=1&timeout=30" tests/test_basic.py tests/test_transactions.py
sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
[testenv:py27-mssql-pymssql-w32]
@@ -638,7 +638,7 @@ platform = win32
commands =
-sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "CREATE DATABASE sqlobject_test"
- pytest -D "mssql://SA:YourStrong!Passw0rd@localhost:1433/sqlobject_test?driver=pytds&debug=1"
+ pytest -D "mssql://SA:YourStrong!Passw0rd@localhost:1433/sqlobject_test?driver=pytds&debug=1&timeout=30" tests/test_basic.py tests/test_transactions.py
sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
[testenv:py27-mssql-pytds-w32]
http://sourceforge.net/p/sqlobject/sqlobject/ci/c3ca3de7003527f009821bc0149bcd55c2f6a552
commit c3ca3de7003527f009821bc0149bcd55c2f6a552
Author: Oleg Broytman <ph...@ph...>
Date: Thu Nov 24 18:07:35 2022 +0300
WIP: Limit OS, Python versions, backends
diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml
index 3a37c58..c6a2ffe 100644
--- a/.github/workflows/run-tests.yaml
+++ b/.github/workflows/run-tests.yaml
@@ -7,12 +7,14 @@ jobs:
strategy:
matrix:
- os: [ubuntu-latest, windows-latest]
- python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
+ #os: [ubuntu-latest, windows-latest]
+ os: [windows-latest]
+ #python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
+ python-version: ["3.7"]
include:
- - os: ubuntu-latest
- os-name: Linux
- pip-cache-path: ~/.cache/pip
+ #- os: ubuntu-latest
+ # os-name: Linux
+ # pip-cache-path: ~/.cache/pip
- os: windows-latest
os-name: w32
pip-cache-path: ~\AppData\Local\pip\Cache
@@ -23,18 +25,18 @@ jobs:
steps:
# Setup MySQL
- - uses: ankane/setup-mysql@v1
+ #- uses: ankane/setup-mysql@v1
# Setup PostgreSQL
- - uses: ankane/setup-postgres@v1
- - name: Setup Postgres user
- run: |
- sudo -u postgres psql --command="ALTER USER runner CREATEDB ENCRYPTED PASSWORD 'test'"
- if: ${{ runner.os == 'Linux' }}
- - name: Setup Postgres user
- run: |
- psql --command="CREATE USER runner CREATEDB ENCRYPTED PASSWORD 'test'"
- if: ${{ runner.os == 'Windows' }}
+ #- uses: ankane/setup-postgres@v1
+ #- name: Setup Postgres user
+ # run: |
+ # sudo -u postgres psql --command="ALTER USER runner CREATEDB ENCRYPTED PASSWORD 'test'"
+ # if: ${{ runner.os == 'Linux' }}
+ #- name: Setup Postgres user
+ # run: |
+ # psql --command="CREATE USER runner CREATEDB ENCRYPTED PASSWORD 'test'"
+ # if: ${{ runner.os == 'Windows' }}
# Setup MS SQL
- uses: ankane/setup-sqlserver@v1
@@ -89,18 +91,18 @@ jobs:
tox --version
- name: Run tox @ Linux
run: |
- devscripts/tox-select-envs $PYVER-mysql
- devscripts/tox-select-envs $PYVER-postgres
- devscripts/tox-select-envs $PYVER-sqlite
+ #devscripts/tox-select-envs $PYVER-mysql
+ #devscripts/tox-select-envs $PYVER-postgres
+ #devscripts/tox-select-envs $PYVER-sqlite
devscripts/tox-select-envs $PYVER-mssql
devscripts/tox-select-envs $PYVER-pytds
devscripts/tox-select-envs $PYVER-flake8
if: ${{ runner.os == 'Linux' }}
- name: Run tox @ w32
run: |
- devscripts\tox-select-envs.cmd %PYVER%-mysql
- devscripts\tox-select-envs.cmd %PYVER%-postgres
- devscripts\tox-select-envs.cmd %PYVER%-sqlite
+ #devscripts\tox-select-envs.cmd %PYVER%-mysql
+ #devscripts\tox-select-envs.cmd %PYVER%-postgres
+ #devscripts\tox-select-envs.cmd %PYVER%-sqlite
devscripts\tox-select-envs.cmd %PYVER%-mssql
devscripts\tox-select-envs.cmd %PYVER%-pytds
if: ${{ runner.os == 'Windows' }}
http://sourceforge.net/p/sqlobject/sqlobject/ci/d25545bf6d5def67ed4eb656787f80bd71c7bfee
commit d25545bf6d5def67ed4eb656787f80bd71c7bfee
Author: Oleg Broytman <ph...@ph...>
Date: Fri Dec 2 19:20:06 2022 +0300
CI(MSSQL): Enable TCP for MSSQL
diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml
index 75da13e..3a37c58 100644
--- a/.github/workflows/run-tests.yaml
+++ b/.github/workflows/run-tests.yaml
@@ -46,6 +46,16 @@ jobs:
sudo apt-get install --yes freetds-bin
echo "SELECT @@VERSION" | tsql -H localhost -p 1433 -U sa -P 'YourStrong!Passw0rd'
if: ${{ runner.os == 'Linux' }}
+ - name: Enable TCP for MSSQL
+ run: |
+ [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SqlWmiManagement')
+ $wmi = New-Object 'Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer' localhost
+ $tcp = $wmi.ServerInstances['MSSQLSERVER'].ServerProtocols['Tcp']
+ $tcp.IsEnabled = $true
+ $tcp.Alter()
+ Restart-Service -Name MSSQLSERVER -Force
+ shell: powershell
+ if: ${{ runner.os == 'Windows' }}
# Setup Python/pip
- uses: actions/checkout@v2
http://sourceforge.net/p/sqlobject/sqlobject/ci/945f696258e623ebf27b6e98aed44b777c9221c2
commit 945f696258e623ebf27b6e98aed44b777c9221c2
Author: Oleg Broytman <ph...@ph...>
Date: Fri Dec 2 19:19:01 2022 +0300
CI(MSSQL): Install and run `tsql`
diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml
index 642afee..75da13e 100644
--- a/.github/workflows/run-tests.yaml
+++ b/.github/workflows/run-tests.yaml
@@ -40,6 +40,12 @@ jobs:
- uses: ankane/setup-sqlserver@v1
with:
accept-eula: true
+ - name: tsql
+ run: |
+ sudo apt-get update --yes
+ sudo apt-get install --yes freetds-bin
+ echo "SELECT @@VERSION" | tsql -H localhost -p 1433 -U sa -P 'YourStrong!Passw0rd'
+ if: ${{ runner.os == 'Linux' }}
# Setup Python/pip
- uses: actions/checkout@v2
http://sourceforge.net/p/sqlobject/sqlobject/ci/4988fdf775add1d96a57a4cf06a45cb809efc2e8
commit 4988fdf775add1d96a57a4cf06a45cb809efc2e8
Author: Oleg Broytman <ph...@ph...>
Date: Thu Nov 24 18:48:01 2022 +0300
CI: Run tests with MS SQL at GH Actions
diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml
index 7b5c8b4..642afee 100644
--- a/.github/workflows/run-tests.yaml
+++ b/.github/workflows/run-tests.yaml
@@ -36,6 +36,11 @@ jobs:
psql --command="CREATE USER runner CREATEDB ENCRYPTED PASSWORD 'test'"
if: ${{ runner.os == 'Windows' }}
+ # Setup MS SQL
+ - uses: ankane/setup-sqlserver@v1
+ with:
+ accept-eula: true
+
# Setup Python/pip
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
@@ -71,6 +76,8 @@ jobs:
devscripts/tox-select-envs $PYVER-mysql
devscripts/tox-select-envs $PYVER-postgres
devscripts/tox-select-envs $PYVER-sqlite
+ devscripts/tox-select-envs $PYVER-mssql
+ devscripts/tox-select-envs $PYVER-pytds
devscripts/tox-select-envs $PYVER-flake8
if: ${{ runner.os == 'Linux' }}
- name: Run tox @ w32
@@ -78,4 +85,6 @@ jobs:
devscripts\tox-select-envs.cmd %PYVER%-mysql
devscripts\tox-select-envs.cmd %PYVER%-postgres
devscripts\tox-select-envs.cmd %PYVER%-sqlite
+ devscripts\tox-select-envs.cmd %PYVER%-mssql
+ devscripts\tox-select-envs.cmd %PYVER%-pytds
if: ${{ runner.os == 'Windows' }}
diff --git a/devscripts/requirements/requirements_pymssql.txt b/devscripts/requirements/requirements_pymssql.txt
new file mode 100644
index 0000000..da5918e
--- /dev/null
+++ b/devscripts/requirements/requirements_pymssql.txt
@@ -0,0 +1,2 @@
+pymssql < 2.2; python_version <= '3.5'
+pymssql; python_version >= '3.6'
diff --git a/docs/News.rst b/docs/News.rst
index 6bb8c30..10acacb 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -21,6 +21,8 @@ Tests, CI
* Run tests with Python 3.11.
+* Run tests with MS SQL at GH Actions.
+
SQLObject 3.10.0
================
diff --git a/tox.ini b/tox.ini
index 81df7f6..fcf70dd 100644
--- a/tox.ini
+++ b/tox.ini
@@ -31,6 +31,8 @@ deps =
pyodbc: pyodbc
pypyodbc: pypyodbc
supersqlite: supersqlite
+ mssql-pymssql: -rdevscripts/requirements/requirements_pymssql.txt
+ mssql-pytds: python-tds
firebird-fdb: fdb
firebirdsql: firebirdsql
passenv = CI
@@ -369,25 +371,6 @@ commands =
# Windows testing
-[mssql-pyodbc-w32]
-platform = win32
-commands =
- {envpython} -c "import pyodbc; print(pyodbc.drivers())"
- -sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "DROP DATABASE sqlobject_test"
- sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "CREATE DATABASE sqlobject_test"
- pytest -D "mssql://sa:Password12!@localhost\SQL2014/sqlobject_test?driver=pyodbc&odbcdrv=SQL%20Server&timeout=30&debug=1"
- sqlcmd -U sa -P "Password12!" -S .\SQL2014 -Q "DROP DATABASE sqlobject_test"
-
-[testenv:py27-mssql-pyodbc-noauto-w32]
-platform = win32
-commands =
- easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
- {[mssql-pyodbc-w32]commands}
-
-[testenv:py3{4,5,6,7,8,9,10,11}-mssql-pyodbc-noauto-w32]
-platform = win32
-commands = {[mssql-pyodbc-w32]commands}
-
[mysql-connector-w32]
platform = win32
commands =
@@ -631,3 +614,53 @@ commands =
[testenv:py3{4,5,6,7,8,9,10,11}-sqlite-memory-w32]
platform = win32
commands = {[sqlite-memory-w32]commands}
+
+[mssql-pymssql-w32]
+platform = win32
+commands =
+ -sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
+ sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "CREATE DATABASE sqlobject_test"
+ pytest -D "mssql://SA:YourStrong!Passw0rd@localhost:1433/sqlobject_test?driver=pymssql&debug=1"
+ sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
+
+[testenv:py27-mssql-pymssql-w32]
+platform = win32
+commands =
+ easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
+ {[mssql-pymssql-w32]commands}
+
+[testenv:py3{4,5,6,7,8,9,10,11}-mssql-pymssql-w32]
+platform = win32
+commands = {[mssql-pymssql-w32]commands}
+
+[mssql-pytds-w32]
+platform = win32
+commands =
+ -sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
+ sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "CREATE DATABASE sqlobject_test"
+ pytest -D "mssql://SA:YourStrong!Passw0rd@localhost:1433/sqlobject_test?driver=pytds&debug=1"
+ sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
+
+[testenv:py27-mssql-pytds-w32]
+platform = win32
+commands =
+ easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
+ {[mssql-pytds-w32]commands}
+
+[testenv:py3{4,5,6,7,8,9,10,11}-mssql-pytds-w32]
+platform = win32
+commands = {[mssql-pytds-w32]commands}
+
+[mssql-pyodbc-w32]
+platform = win32
+commands =
+ {envpython} -c "import pyodbc; print(pyodbc.drivers())"
+ -sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
+ sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "CREATE DATABASE sqlobject_test"
+ pytest -D "mssql://SA:YourStrong!Passw0rd@localhost/sqlobject_test?driver=pyodbc&odbcdrv=SQL%20Server&debug=1"
+ sqlcmd -U SA -P "YourStrong!Passw0rd" -Q "DROP DATABASE sqlobject_test"
+
+[testenv:py27-mssql-pyodbc-noauto-w32]
+platform = win32
+commands =
+ easy_install -i https://downloads.egenix.com/python/index/ucs2/ egenix-mx-base
http://sourceforge.net/p/sqlobject/sqlobject/ci/57213a91846acad97526d3b8ab5796b98ca45499
commit 57213a91846acad97526d3b8ab5796b98ca45499
Author: Oleg Broytman <ph...@ph...>
Date: Thu Nov 24 18:37:38 2022 +0300
Feat(MSSQL): Use driver `pytds`
diff --git a/README.rst b/README.rst
index 8c31039..3591a36 100644
--- a/README.rst
+++ b/README.rst
@@ -10,9 +10,9 @@ SQLObject supports a number of backends: MySQL/MariaDB (with a number of
DB API drivers: ``MySQLdb``, ``mysqlclient``, ``mysql-connector``,
``PyMySQL``, ``mariadb``), PostgreSQL (``psycopg2``, ``PyGreSQL``,
partially ``pg8000`` and ``py-postgresql``), SQLite (builtin ``sqlite``,
-``pysqlite``, partially ``supersqlite``); connections to other backends
-- Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB) - are less
-debugged).
+``pysqlite``, partially ``supersqlite``); MSSQL Server (``pymssql`` or
+``pytds``); connections to other backends - Firebird, Sybase and MaxDB
+(also known as SAPDB) - are less debugged).
Python 2.7 or 3.4+ is required.
diff --git a/docs/News.rst b/docs/News.rst
index 0eaaa97..6bb8c30 100644
--- a/docs/News.rst
+++ b/docs/News.rst
@@ -14,6 +14,8 @@ Minor features
* Use ``module_loader.exec_module(module_loader.create_module())``
instead of ``module_loader.load_module()`` when available.
+* Use driver ``pytds``.
+
Tests, CI
---------
diff --git a/docs/SQLObject.rst b/docs/SQLObject.rst
index 56f2541..772cc35 100644
--- a/docs/SQLObject.rst
+++ b/docs/SQLObject.rst
@@ -53,8 +53,8 @@ PostgreSQL_ psycopg2_ is recommended; PyGreSQL_, py-postgresql_ and pg8000_
are supported; SQLite_ has a built-in driver, PySQLite_ or supersqlite_.
Firebird_ is supported via fdb_ or kinterbasdb_; pyfirebirdsql_ is
supported but has problems. `MAX DB`_ (also known as SAP DB) is supported
-via sapdb_. Sybase via Sybase_. `MSSQL Server`_ via pymssql_ (+ FreeTDS_)
-or adodbapi_ (Win32). PyODBC_ and PyPyODBC_ are supported for MySQL,
+via sapdb_. Sybase via Sybase_. `MSSQL Server`_ via pymssql_ (+ FreeTDS_),
+`pytds`_ or adodbapi_ (Win32). PyODBC_ and PyPyODBC_ are supported for MySQL,
PostgreSQL and MSSQL but have problems (not all tests passed).
.. _MySQL: https://www.mysql.com/
@@ -83,6 +83,7 @@ PostgreSQL and MSSQL but have problems (not all tests passed).
.. _`MSSQL Server`: http://www.microsoft.com/sql/
.. _pymssql: http://www.pymssql.org/en/latest/index.html
.. _FreeTDS: http://www.freetds.org/
+.. _pytds: https://pypi.org/project/python-tds/
.. _adodbapi: http://adodbapi.sourceforge.net/
.. _PyODBC: https://pypi.org/project/pyodbc/
.. _PyPyODBC: https://pypi.org/project/pypyodbc/
diff --git a/setup.py b/setup.py
index b67aa31..32c7e42 100755
--- a/setup.py
+++ b/setup.py
@@ -110,9 +110,6 @@ and `GitHub <https://github.com/sqlobject>`_.
'fdb': ['fdb'],
'firebirdsql': ['firebirdsql'],
'kinterbasdb': ['kinterbasdb'],
- # MS SQL
- 'adodbapi': ['adodbapi'],
- 'pymssql': ['pymssql'],
# MySQL
'mysql:python_version=="2.7"': ['MySQL-python'],
'mysql:python_version>="3.4"': ['mysqlclient'],
@@ -123,6 +120,10 @@ and `GitHub <https://github.com/sqlobject>`_.
'oursql3 @ git+https://github.com/sqlobject/oursql.git@py3k'],
'pymysql': ['pymysql'],
'mariadb': ['mariadb'],
+ # MS SQL
+ 'adodbapi': ['adodbapi'],
+ 'pymssql': ['pymssql'],
+ 'pytds': ['python-tds'],
# ODBC
'odbc': ['pyodbc'],
'pyodbc': ['pyodbc'],
diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py
index 13cb89a..4d2ac35 100644
--- a/sqlobject/mssql/mssqlconnection.py
+++ b/sqlobject/mssql/mssqlconnection.py
@@ -16,7 +16,7 @@ class MSSQLConnection(DBAPI):
def __init__(self, db, user, password='', host='localhost', port=None,
autoCommit=0, **kw):
- drivers = kw.pop('driver', None) or 'adodb,pymssql'
+ drivers = kw.pop('driver', None) or 'adodb,pymssql,pytds'
for driver in drivers.split(','):
driver = driver.strip()
if not driver:
@@ -28,6 +28,9 @@ class MSSQLConnection(DBAPI):
elif driver == 'pymssql':
import pymssql
self.module = pymssql
+ elif driver == 'pytds':
+ import pytds
+ self.module = pytds
elif driver == 'pyodbc':
import pyodbc
self.module = pyodbc
@@ -43,7 +46,7 @@ class MSSQLConnection(DBAPI):
else:
raise ValueError(
'Unknown MSSQL driver "%s", '
- 'expected adodb, pymssql, '
+ 'expected adodb, pymssql, pytds, '
'odbc, pyodbc or pypyodbc' % driver)
except ImportError:
pass
@@ -84,9 +87,10 @@ class MSSQLConnection(DBAPI):
kw.pop("ncli", None)
kw.pop("sspi", None)
- elif driver == 'pymssql':
+ elif driver in ('pymssql', 'pytds'):
+ self.dbconnection = self.module.connect
self.module.Binary = lambda st: str(st)
- # don't know whether pymssql uses unicode
+ # don't know whether pymssql/pytds use unicode
self.usingUnicodeStrings = False
def _make_conn_str(keys):
@@ -95,7 +99,9 @@ class MSSQLConnection(DBAPI):
('database', keys.db),
('user', keys.user),
('password', keys.password),
- ('host', keys.host),
+ ('host', keys.host)
+ if driver == 'pymssql' else # pytds
+ ('dsn', keys.host),
('port', keys.port),
('timeout', keys.timeout),
):
@@ -183,7 +189,7 @@ class MSSQLConnection(DBAPI):
c.close()
elif self.driver == 'pymssql':
conn.autocommit(auto)
- elif self.driver in ('odbc', 'pyodbc', 'pypyodbc'):
+ elif self.driver in ('pytds', 'odbc', 'pyodbc', 'pypyodbc'):
conn.autocommit = auto
HAS_IDENTITY = """
http://sourceforge.net/p/sqlobject/sqlobject/ci/55f85966c333f3488e7ca7a912ef09d2bae8b2d0
commit 55f85966c333f3488e7ca7a912ef09d2bae8b2d0
Author: Oleg Broytman <ph...@ph...>
Date: Thu Nov 24 18:31:03 2022 +0300
Refactor(mssqlconnection): Use `self.module`
Move ODBC-related code.
diff --git a/sqlobject/mssql/mssqlconnection.py b/sqlobject/mssql/mssqlconnection.py
index d439543..13cb89a 100644
--- a/sqlobject/mssql/mssqlconnection.py
+++ b/sqlobject/mssql/mssqlconnection.py
@@ -23,9 +23,11 @@ class MSSQLConnection(DBAPI):
continue
... 679 lines suppressed ...
hooks/post-receive
--
SQLObject development repository
|