1
votes

Is there a way of getting the metadata of a query?

I can use DESCRIBE but this only applies to tables, I don't really want to have to create a table from the query and get the metadata of that table as that would be unnecessarily expensive even if I limited the result rows.

I'm using impala shell to output queries to delimited files (usually only a couple of hundred rows) which are sometimes needed to be imported into an Access database.

I'd like to know the data types as then I can make Access use the correct data types rather than defaulting to string.

1
You could CREATE VIEW xxxx AS, then DESCRIBE xxxx, then DROP VIEW xxxx. No need to execute it. - Samson Scharfrichter
Thanks, that seems to do the trick, do you want to stick it as an answer so I can mark it as such? - Tim Edwards
Nah... that trick is not really worth 15 pts (it works with any database that supports views, by the way) - Samson Scharfrichter
@SamsonScharfrichter marking as an answer will help many people looking for answers (or looking to answer) to know that it is an accepted answer. It's a good answer -- go for it :-) - Tom Harrison
...or @Tim could update the title so that it shows [Solved] Describe Impala Query Metadata. - Samson Scharfrichter

1 Answers

0
votes

The answer, thanks to @SamsonScharfrichter is

CREATE VIEW xxxx AS, then DESCRIBE xxxx, then DROP VIEW xxxx.