Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/rdbms-connect/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

1.0.3
++++++
+ Add support to read UTF-8 files with and without BOM

1.0.2
++++++
+ Use compatible release for `setproctitle` to support Python 3.10
Expand Down
2 changes: 1 addition & 1 deletion src/rdbms-connect/azext_rdbms_connect/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def _connect_execute_file(server_type, host, server_name, database_name, login_u
logger.warning("Running sql file '%s'...", file_path)
cursor = connection.cursor()

with open(file_path, "r", encoding="utf-8") as sql_file:
with open(file_path, "r", encoding="utf-8-sig") as sql_file:
cursor.execute(sql_file.read())

if server_type == 'postgres':
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class RdbmsConnectMgmtScenarioTest(ScenarioTest):

postgres_location = 'eastus'
mysql_location = 'westus2'
mysql_location = 'westus'

@AllowLargeResponse()
@ResourceGroupPreparer(location=postgres_location)
Expand Down Expand Up @@ -107,6 +107,13 @@ def _test_successful_connect(self, database_engine, resource_group):
self.cmd('{} flexible-server execute -n {} -u {} -p {} -d {} -f {}'
.format(database_engine, server_name, username, generated_password, default_database, file_path))

# test file execution encoded with BOM
with open(file_path, "wb") as sql_file:
sql_file.write(b"\xef\xbb\xbfCREATE DATABASE sampledb2;")

self.cmd('{} flexible-server execute -n {} -u {} -p {} -d {} -f {}'
.format(database_engine, server_name, username, generated_password, default_database, file_path))

os.remove(file_path)

def _test_vnet_connect(self, database_engine, resource_group):
Expand Down
2 changes: 1 addition & 1 deletion src/rdbms-connect/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '1.0.2'
VERSION = '1.0.3'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down