I am trying to work with a database that I barly know and I need to know column names of a table:
Here is what I tried:
client = DataFrameClient(host, 8086, username, password, "marketdata")
client.switch_database('marketdata')
print(client.query("show measurements"))
# ResultSet({'('measurements', None)': [{'name': 'bookTicker'}]})
query = "SELECT COUNT(DISTINCT bookTicker) FROM information_schema.columns WHERE table_schema = 'marketdata'"
dataframes = client.query(query)
raise InfluxDBClientError(self.error)
influxdb.exceptions.InfluxDBClientError: retention policy not found: information_schema
I also tried:
query = "select * from bookTicker limit 10"
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))
You are trying to use SQL
knowledge for nonSQL InfluxDB.
InfluxDB
doesn't have concept of columns, but tags (in SQL meaning something like indexed column) and fields (something like a column).
You can explore them with the queries:
SHOW TAG KEYS [ON <database_name>] [FROM_clause] [WHERE <tag_key> ['<tag_value>' | <regular_expression>]] [LIMIT_clause] [OFFSET_clause]
https://docs.influxdata.com/influxdb/v1.7/query_language/schema_exploration/#show-tag-keys
SHOW FIELD KEYS [ON <database_name>] [FROM <measurement_name>]
https://docs.influxdata.com/influxdb/v1.7/query_language/schema_exploration/#show-field-keys