I am reading data from influxdb into pandas with the below code:-
import pandas as pd
from influxdb import InfluxDBClient
client = InfluxDBClient(host='10.0.0.0', port=7076, username='abcdefghi',
password='dsdsd', ssl=False, verify_ssl=False)
read_client.switch_database('test')
q = 'SELECT * FROM "abc"
df = pd.DataFrame(read_client.query(
q, chunked=False, chunk_size=10000).get_points())
df
Then I am doing some processing.
Now, I have 50 domains and for some domains the influxdbclient
is different. Now I want to do something so that it can take input from argpase and I can pass the read client on command line.
I want to keep one common connecting string which will be default and if we pass --influx_host on command line then it should consider that. I am new to this kind of programming in python. I was able to achieve passing variables but not able to Create a connection string. I will appreciate any help.
Basically if I can do something like below or anything better.:-
python test.py -influx_host 10.0.0.10 --port 7076