Skip to content

Commit ae4a5f6

Browse files
authored
Merge pull request #1000 from koordinates/fix-mssql-instance
Fix mssql instance names
2 parents 4893428 + 9be521b commit ae4a5f6

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ _When adding new entries to the changelog, please include issue/PR numbers where
77
## 0.15.3 (UNRELEASED)
88

99
- Replaces minimal patches with delta-filters - a more general-purpose way of filtering parts (inserts, updates, deletes) of JSON diffs when not all parts are required. [#998](https://github.com/koordinates/kart/pull/998)
10+
- Remove automatic resolution of `localhost` before calling MSSQL driver. Fixes SQL Server instance names issue. [#999](https://github.com/koordinates/kart/issues/999)
1011

1112
## 0.15.2
1213

kart/sqlalchemy/base.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ def _pool_class(cls):
5252
# But this fix is simpler for now: disable the pool during testing.
5353
return NullPool if "PYTEST_CURRENT_TEST" in os.environ else None
5454

55-
@classmethod
56-
def _replace_localhost_with_ip(cls, url_netloc):
57-
def _get_localhost_ip(*args, **kwargs):
58-
return socket.gethostbyname("localhost")
59-
60-
return re.sub(r"\blocalhost\b", _get_localhost_ip, url_netloc)
61-
6255
@classmethod
6356
def _append_query_to_url(cls, uri, new_query_dict):
6457
url = urlsplit(uri)

kart/sqlalchemy/sqlserver.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ def create_engine(cls, msurl):
3131
{"driver": cls.get_sqlserver_driver(), "Application Name": "kart"},
3232
)
3333

34-
# SQL Server driver prefers 127.0.0.1 or similar to localhost.
35-
url_netloc = cls._replace_localhost_with_ip(url.netloc)
36-
37-
msurl = urlunsplit([cls.INTERNAL_SCHEME, url_netloc, url.path, url_query, ""])
34+
msurl = urlunsplit([cls.INTERNAL_SCHEME, url.netloc, url.path, url_query, ""])
3835

3936
engine = sqlalchemy.create_engine(msurl, poolclass=cls._pool_class())
4037
return engine

requirements/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pygments==2.13.0
5050
# rst2txt
5151
pymysql==1.0.2
5252
# via -r requirements.in
53-
pyodbc==5.0.1
53+
pyodbc==5.1.0
5454
# via -r vendor-wheels.txt
5555
pyrsistent==0.19.2
5656
# via jsonschema

requirements/vendor-wheels.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ cryptography==42.0.4
33
gdal==3.8.0
44
psycopg2==2.9.9
55
pygit2==1.12.1
6-
pyodbc==5.0.1
6+
pyodbc==5.1.0
77
pysqlite3==0.5.2
88
reflink==0.2.2

vcpkg-vendor/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ include_dirs=${BUILD_WHEEL_INCLUDE_DIRS}
289289
library_dirs=${BUILD_WHEEL_LIBRARY_DIRS}
290290
")
291291

292-
set(PYODBC_WHEEL_VER 5.0.1)
292+
set(PYODBC_WHEEL_VER 5.1.0)
293293
ExternalProject_Add(
294294
pyodbc
295295
# if you build from a git repository, pyodbc adds +commit0c0ffee to the wheel version
296-
URL https://files.pythonhosted.org/packages/22/6f/012f32aecf744e439980257be0ba4dd8c70a4e03c9f86f5fcd986fbfb012/pyodbc-5.0.1.tar.gz
297-
URL_HASH SHA256=03d7d0b04d5a9156099ce8d03e92f3956783746fa9234eb6f5b5cfc12b645011
296+
URL https://files.pythonhosted.org/packages/d5/5b/a93f7017d4df84c3971cf60ee935149f12e0d1e111febc67ba2e23015a79/pyodbc-5.1.0.tar.gz
297+
URL_HASH SHA256=397feee44561a6580be08cedbe986436859563f4bb378f48224655c8e987ea60
298298
DOWNLOAD_NO_PROGRESS ON
299299
BUILD_IN_SOURCE ON
300300
DEPENDS wheelBuildEnv ${PYODBC_BUILD_DEPENDS}

0 commit comments

Comments
 (0)