[for each dataset] fails on table names containing whitespaces
See original GitHub issueProblem
Applies to SQL Server: when for each dataset
is used on a table name containing whitespaces (example: Contact Type
), the following syntax error is thrown:
Soda Core 3.0.10
Query execution error in nav.Contact Type.aggregation[0]: ('42S02', "[42S02] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Invalid object name 'Contact'. (208) (SQLExecDirectW)")
SELECT
COUNT(*)
FROM dbo.Contact Type
Suspected cause
I think this happens because of omitted object identifiers in the SQL-statements (the sqlserver-dialect of) Soda generates here. MSSQL expects dbo.Contact Type
to be enclosed with (preferably) brackets, like [dbo].[Contact Type]
. Seen this issue before in Soda <-> MSSQL (https://github.com/sodadata/soda-sql/issues/171, https://github.com/sodadata/soda-sql/issues/181).
Steps to reproduce
- Have a Microsoft SQL Server instance with a table containing a column with a white-space character in it’s name.
- Configure checks.yml with at least:
for each dataset T:
datasets:
- "Contact Type"
- Country
checks:
...
- Run soda scan
System Docker version: 20.10.17 Soda Core version: 3.0.10 Data source type: Microsoft SQL Server 2019 (15.0.2080.9)
Let me know if I can test anything for you on sqlserver! ✋🏼
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Error when querying a SQL Server view with whitespace in the ...
Try using the syntax: $table = "['my_other view']". Where you use single quotes around the table name inside of square brackets.
Read more >How to write SQL queries with spaces in column names
In this article, we are going to learn how we can write a SQL query with space in the column name. Blanks spaces...
Read more >fread fails if whitespace before first character #1035 - GitHub
Each row begins with two white spaces, but the separator for the rest of the values is a single white space. In version...
Read more >Dealing with extra white spaces while reading CSV in Pandas
Our dataset contains these columns: Id which identifies each row; Street which has initial and trailing white space; City which has leading ...
Read more >Column name can not contain leading or trailing white spaces ...
I am doing a join on several columns. I just changed the name of one and now I have an error regarding columns...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@geertvanzoest Ah, Indeed we have to separate “quoting” in metadata queries and normal queries. I’ll see how to fix it in 3.0.17
This is the result:
Soda doesn’t evaluate the table when using
for each "[Table Name]"
because it tries to fetch the objectname from the information_schema using this query:As you can see, the brackets are parsed as being part of the objectname instead of being parsed as object identifiers. Therefore, no result is returned from information_schema and the table isn’t checked by Soda.
So just for funzies, when I use this checks.yml:
This is the result 😃
Let me know if I can do anything else to help.