Show column data type in schema browser

It would be really useful if the schema browser displayed the data type of columns.

For example if there’s a column called start_time, it’s not clear if this is actually a datetime, time or string. This matters if the user wants to know how to structure a WHERE clause or add a parameter to the query.

Similarly with numeric data types, for example it can be very important to know if data is being stored as a numeric or floating point data type as floating point arithmetic can lead to inaccuracies and it’s not always possible to discover this just by looking at the data.

You might also want to consider an extensible way to show custom properties e.g. indicate which is the distribution column in systems like Teradata and Redshift.

1 Like

i strongly support this!

You can show support by voting for features you want to see.

We would also gladly review a pull request for this.

The service providing columns/schema seems to respond with columns as string array. if we are to implement the requested feature then this should be object containing a name and type attributes.
So far it is easy, but looking at the source i see metadata for each technology is provided with own
query runner under redash/query_runner/ if i am not wrong we have to implement this for each runner
and that requires the knowledge of acquiring column metadata for each technology.

am i correct ?

implemented it for postgres,
shows the type on hover

datatype

Your logic is right. But it would be much easier to simply fall back to the current behavior if the query runner doesn’t supply type information, no?

yes it falls back to current behavior,
btw. i was trying to test it with sqlite but i noticed one thing, maybe a bit off topic but,

  1. create and insert statements results in an error, although op. completes with success
CREATE TABLE coffees (
  id INTEGER PRIMARY KEY,
  coffee_name TEXT NOT NULL,
  price REAL NOT NULL
);

insert into coffees values(null, 'Turkish', 8.99);

Redash is built as a read-only tool. Coincidentally you can run INSERT, UPDATE, and DELETE statements but we don’t recommend it.

This looks great, have you created a PR?

what’s the relationship between mozilla/ redash and getredash/ redash? a similar feature (schema viewer drawer?) has already been implemented in mozilla/ redash. It seems to work. Is it a buggy beta?

Unfortunately i couldn’t find a clean and short solution, see the img below, columns are string type
instead they should be object and when you make them them object you have to implement this feature for all query runners, there are two ways to implement; partially for query runners(which i can only do, cause i don’t have access to all data sources redash supports, to test ) or do it for all data sources.

(supposing handled in backend)
The partial solution is dirty because, you have to check the schema_dict if it contains string(for unimplented data sources) or object(the ones we implement) and mutate it to convert all string columns
to something like {name: "col_name", type: None} which is not cool and confusing for new comers.

The true solution, also regarding your latter post about mozilla/redash, is implemented in this
commit

See redash/models/__init__.py they introduce new structures like ColumnMetadata which is the right way to do it.
Their commit also contains many other changes, i suppose it may take some time to review and merge.

And the relation between mozilla and getredash i guess (the redash team may answer better) the mozilla one is just a fork to contribute.

Bingo. Mozilla runs a very successful fork of Redash. They are regular commiters to getredash/redash and have merge privileges on the same.

aha, no wonder i saw almost the same group of contributors in both places
do you happen to know the timeline of the next big merge? i’m in dire need of this column data type thing.
trying to decide if i should wait or just switch base to mozilla

It’s doesn’t quite work like that. Mozilla’s fork of Redash is heavily customized to their needs. It’s not designed or marketed for general use. Sometimes they contribute new features upstream, though. For example the react migration began on their team.

I checked and it sounds like schema data types will be implemented by getredash/redash (exact date TBD). But we probably won’t use Mozilla’s drawer UI.

Thanks for bringing this to our attention. Til now this feature wasn’t on our radar due to minimal interest on the forum (one vote in eighteen months).

i see. i’ll switch base for now.
my guess is that the actual users of redash may not go to a forum to up vote a feature request :grinning:
in fact, i’m not a user either. redash is the endpoint of our data warehouse/datalake