Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing mysql error message #14416

Merged
merged 7 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions superset/db_engine_specs/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@

# Regular expressions to catch custom errors
CONNECTION_ACCESS_DENIED_REGEX = re.compile(
"Access denied for user '(?P<username>.*?)'@'(?P<hostname>.*?)'. "
"Access denied for user '(?P<username>.*?)'@'(?P<hostname>.*?)' "
AAfghahi marked this conversation as resolved.
Show resolved Hide resolved
AAfghahi marked this conversation as resolved.
Show resolved Hide resolved
)
CONNECTION_INVALID_HOSTNAME_REGEX = re.compile(
"Unknown MySQL server host '(?P<hostname>.*?)'."
"Unknown MySQL server host '(?P<hostname>.*?)'"
)
CONNECTION_HOST_DOWN_REGEX = re.compile(
"Can't connect to MySQL server on '(?P<hostname>.*?)'."
"Can't connect to MySQL server on '(?P<hostname>.*?)'"
)
CONNECTION_UNKNOWN_DATABASE_REGEX = re.compile("Unknown database '(?P<database>.*?)'.")

Expand Down
10 changes: 5 additions & 5 deletions tests/db_engine_specs/mysql_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_extract_errors(self):
"""
Test that custom error messages are extracted correctly.
"""
msg = "mysql: Access denied for user 'test'@'testuser.com'. "
msg = "mysql: Access denied for user 'test'@'testuser.com' "
AAfghahi marked this conversation as resolved.
Show resolved Hide resolved
result = MySQLEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
Expand All @@ -135,7 +135,7 @@ def test_extract_errors(self):
)
]

msg = "mysql: Unknown MySQL server host 'badhostname.com'. "
msg = "mysql: Unknown MySQL server host 'badhostname.com' "
AAfghahi marked this conversation as resolved.
Show resolved Hide resolved
result = MySQLEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
Expand All @@ -155,7 +155,7 @@ def test_extract_errors(self):
)
]

msg = "mysql: Can't connect to MySQL server on 'badconnection.com'."
msg = "mysql: Can't connect to MySQL server on 'badconnection.com'"
result = MySQLEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
Expand All @@ -176,7 +176,7 @@ def test_extract_errors(self):
)
]

msg = "mysql: Can't connect to MySQL server on '93.184.216.34'."
msg = "mysql: Can't connect to MySQL server on '93.184.216.34'"
result = MySQLEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
Expand All @@ -196,7 +196,7 @@ def test_extract_errors(self):
)
]

msg = "mysql: Unknown database 'badDB'."
msg = "mysql: Unknown database 'badDB'.ß"
AAfghahi marked this conversation as resolved.
Show resolved Hide resolved
result = MySQLEngineSpec.extract_errors(Exception(msg))
assert result == [
SupersetError(
Expand Down