How do I get the column types of a query? In Click...
# questions-and-troubleshooting
c
How do I get the column types of a query? In Clickhouse, I could do the following
Copy code
> describe (select [1,2,3])
   ┌─name──────┬─type─────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
1. │ [1, 2, 3] │ Array(UInt8) │              │                    │         │                  │                │
   └───────────┴──────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
And I know exactly the
type
s of the result.
r
You can use
CREATE VIEW AS
and delete it afterward or another option is using the http
curl -X POST 'http://<fe-ip>:<fe-http-port>/api/v1/catalogs/<catalog-name>/databases/<db-name>/sql' -u '<user>:<password>' -d '{"query": "<query>"}' --header "Content-Type: application/json"
If you just need the data type, you can put
limit 0
on the query.
👍 1