Skip to content

Commit

Permalink
[db-up] az sql up: Fix pymssql installation issue (#3874)
Browse files Browse the repository at this point in the history
* Upgrade psycopg2

* pymssql installation

* fix typo

* Update src/db-up/HISTORY.rst
  • Loading branch information
evelyn-ys authored Sep 16, 2021
1 parent 5c5227a commit 5bd044b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/db-up/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
0.2.6 (2021-09-08)
++++++++++++++++++
* `az sql up`: Fix pymssql installation failure with Python 3.8/3.9

0.2.5 (2021-09-07)
++++++++++++++++++
* Fix psycopg2 dependency issue
Expand Down
4 changes: 2 additions & 2 deletions src/db-up/azext_db_up/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _ensure_pymssql():
python_path = os.environ.get('PYTHONPATH', '')
os.environ['PYTHONPATH'] = python_path + ':' + db_up_ext_path if python_path else db_up_ext_path
cmd = [sys.executable, '-m', 'pip', 'install', '--target', db_up_ext_path,
'pymssql==2.1.4', '-vv', '--disable-pip-version-check', '--no-cache-dir']
'pymssql==2.2.2', '-vv', '--disable-pip-version-check', '--no-cache-dir']
logger.warning(' Installing "pymssql" pip packages')
with HomebrewPipPatch():
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
Expand Down Expand Up @@ -396,7 +396,7 @@ def _run_sql_commands(host, user, password, database):
_ensure_pymssql()
import pymssql
with pymssql.connect(host, user, password, database, tds_version='7.0') as connection:
logger.warning('Successfully Connected to PostgreSQL.')
logger.warning('Successfully Connected to Azure SQL.')
with connection.cursor() as cursor:
try:
db_password = _create_db_password(database)
Expand Down
6 changes: 5 additions & 1 deletion src/db-up/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import sys
from codecs import open
from setuptools import setup, find_packages

VERSION = "0.2.5"
VERSION = "0.2.6"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand All @@ -28,6 +29,9 @@
'psycopg2-binary==2.9.1'
]

if sys.platform != 'darwin':
DEPENDENCIES.append('pymssql==2.2.2')

setup(
name='db-up',
version=VERSION,
Expand Down

0 comments on commit 5bd044b

Please sign in to comment.