How to stop TinyInt converting to Boolean in Looker?
- Datameer, Inc.
- January 22, 2018
PROBLEM STATEMENT:
It has been observed that if we use Looker with a MySQL 5.6 connection, and if we query a tinyint column, the values are converted to boolean by Looker.
For Example:
Consider the following SQL where test_tiny_int column in the test_table holds tiny_int values
SELECT distinct test_tiny_int FROM test_table
The above query returns the following results in Looker
If you run the same query directly in MySQL, it returns the following result set:
Use cast function in LookML when defining the SQL parameter for the dimension so that the resulting SQL resolves to the following SOLUTION:
SELECT distinct cast(test_tiny_int) FROM test_table
That is how to stop a TinyInt from converting to Boolean in Looker.