Search code examples
pythoninfluxdbinfluxdb-python

How to use multiple dbs in one query?


How would one write this piece of code using influxdb-python client?

SELECT column1 INTO 'db2.retention_policy2.measurement2.' FROM 'db1.retention_policy1.measurement1.' WHERE time > '2019-01-01';"

I get the fact that you can create two connections, or even just use one connection to query a db.

One approach could be this:

  1. Get the data required from db1
  2. Switch db using connection.switch_database("db2")
  3. Then what are some way(s) to push the data into db2?

Thank you.


Solution

  • I just had to give read/write permissions to both databases.