Skip to content

Commit

Permalink
Merge pull request #1000 from koordinates/fix-mssql-instance
Browse files Browse the repository at this point in the history
Fix mssql instance names
  • Loading branch information
olsen232 authored Sep 5, 2024
2 parents 4893428 + 9be521b commit ae4a5f6
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ _When adding new entries to the changelog, please include issue/PR numbers where
## 0.15.3 (UNRELEASED)

- 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)
- Remove automatic resolution of `localhost` before calling MSSQL driver. Fixes SQL Server instance names issue. [#999](https://github.com/koordinates/kart/issues/999)

## 0.15.2

Expand Down
7 changes: 0 additions & 7 deletions kart/sqlalchemy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ def _pool_class(cls):
# But this fix is simpler for now: disable the pool during testing.
return NullPool if "PYTEST_CURRENT_TEST" in os.environ else None

@classmethod
def _replace_localhost_with_ip(cls, url_netloc):
def _get_localhost_ip(*args, **kwargs):
return socket.gethostbyname("localhost")

return re.sub(r"\blocalhost\b", _get_localhost_ip, url_netloc)

@classmethod
def _append_query_to_url(cls, uri, new_query_dict):
url = urlsplit(uri)
Expand Down
5 changes: 1 addition & 4 deletions kart/sqlalchemy/sqlserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ def create_engine(cls, msurl):
{"driver": cls.get_sqlserver_driver(), "Application Name": "kart"},
)

# SQL Server driver prefers 127.0.0.1 or similar to localhost.
url_netloc = cls._replace_localhost_with_ip(url.netloc)

msurl = urlunsplit([cls.INTERNAL_SCHEME, url_netloc, url.path, url_query, ""])
msurl = urlunsplit([cls.INTERNAL_SCHEME, url.netloc, url.path, url_query, ""])

engine = sqlalchemy.create_engine(msurl, poolclass=cls._pool_class())
return engine
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pygments==2.13.0
# rst2txt
pymysql==1.0.2
# via -r requirements.in
pyodbc==5.0.1
pyodbc==5.1.0
# via -r vendor-wheels.txt
pyrsistent==0.19.2
# via jsonschema
Expand Down
2 changes: 1 addition & 1 deletion requirements/vendor-wheels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ cryptography==42.0.4
gdal==3.8.0
psycopg2==2.9.9
pygit2==1.12.1
pyodbc==5.0.1
pyodbc==5.1.0
pysqlite3==0.5.2
reflink==0.2.2
6 changes: 3 additions & 3 deletions vcpkg-vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ include_dirs=${BUILD_WHEEL_INCLUDE_DIRS}
library_dirs=${BUILD_WHEEL_LIBRARY_DIRS}
")

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

0 comments on commit ae4a5f6

Please sign in to comment.