Data type not shown correctly in SQL editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 01:29 AM
When selecting from a table in the SQL editor it doesn't always preview the actual data type that the column is. e.g. I have a decimal() data type in one of my tables and when I select it it previews to a float with 2 decimals (which is different from what the type actually is when I go to check it out in the Data explorer). When you hit "preview visualisation data" the pop up window also shows the correct data type (i.e. decimal(38,9) and not float()). It also says that "The visualisation data matches what is displayed in the editor and the results" which, as you can see in the pic below, is not the case.
- Labels:
-
SQL
-
SQL Editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 06:31 AM
Hi @Alva Winsa ,
Where do you see that the data type is changing? That might be a bug that needs to be reported.
One thing that can happen is the SQL editor output will automatically round to the nearest two decimals as shown in the screenshot, this can be changed by editing the table results and changing the number format to include more decimals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 06:46 AM
Hey thanks for your response!
That definitely seems like what's happening! I'm new to Databricks -- where can I find that editor?
So my problem was actually two-pronged but I only outlined part of the problem above, which you seem to have solved!
The other part of the problem is that I'm casting this column as a decimal (38,32) in dbt. And seemingly in dbt that works well and gives me the expected results. However, in Databricks the column is altered to decimal(38,9). How can I tackle this?
Thanks!
Alva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2023 07:01 AM