-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
MS SQL server query runner: improved query for redash/query_runner/mssql.py #7173
Comments
I wrote the new query to one mssql.py within docker folders, apparently there are more so I should test another way. |
I followed the instructions to set up a local development environment and before make and make build I changed the def _get_tables(self, schema) to be the same as in my suggestion The sort order was not followed in the query builder, still alphabetical. |
According to instructions first commit then testing :) == short test summary info == _________ TestAlertRenderTemplate.test_render_custom_alert_template _________________ self = <tests.models.test_alerts.TestAlertRenderTemplate testMethod=test_render_custom_alert_template>
E AssertionError: "\n<p[165 chars]ps://http://localhost:5001/default/alerts/1\nQ[213 chars]e>\n" != "\n<p[165 chars]ps:///default/a lerts/1\nQUERY_NAME Qu[171 chars]e>\n" tests/models/test_alerts.py:181: AssertionError |
CURRENT VERSION:
def _get_tables(self, schema):
query = """
SELECT table_schema, table_name, column_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema NOT IN ('guest','INFORMATION_SCHEMA','sys','db_owner','db_accessadmin'
,'db_securityadmin','db_ddladmin','db_backupoperator','db_datareader'
,'db_datawriter','db_denydatareader','db_denydatawriter'
);
"""
causes problems in query execution when there are spaces or special characters in SQL table or column names, probably also schema name.
In addition the column should be sorted in their SQL Server order and not alphabetically, this would improve usability.
SUGGESTED NEW VERSION
(this worked in local test or connection was created, double concats are needed for MS SQL server - BUT in query builder the tables and column still turned out as table name, column name instead of the [table name], [column name] what would have been the input from this query)
So apparently this also or only an issue with query builder?
The text was updated successfully, but these errors were encountered: