influxdata / influxdata/influxdb
InfluxDB unable to write to CSV file.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
I use Inflluxdb 1.6.4
I use a Python script to send a CSV file to an Influx database. The script runs without errors, and when I check the logs of the InfluxDB Kubernetes container, it shows that it receives the write requests successfully (e.g., [httpd] 10.244.0.1 - admin [01/Dec/2023:05:22:40 +0000] "POST /write?db=ric_test HTTP/1.1" 204 0 "-" "python-requests/2.23.0" a5e794c0-9009-11ee-8523-0a4914573a6e 2245). However, when I check the measurements in the InfluxDB database, it shows no results.
This is my python file.
import datetime
import time
import pandas as pd
from database import DATABASE
from configparser import ConfigParser
class INSERTDATA(DATABASE):
def __init__(self):
super().__init__()
self.config()
self.connect()
# self.dropdb('RIC-Test')
# self.createdb('RIC-Test')
def config(self):
cfg = ConfigParser()
cfg.read('ad_config.ini')
for section in cfg.sections():
if section == 'influxdb':
self.host = cfg.get(section, "host")
self.port = cfg.get(section, "port")
self.user = cfg.get(section, "user")
self.password = cfg.get(section, "password")
self.path = cfg.get(section, "path")
self.ssl = cfg.get(section, "ssl")
self.dbname = cfg.get(section, "database")
self.meas = cfg.get(section, "measurement")
def createdb(self, dbname):
print("Create database: " + dbname)
self.client.create_database(dbname)
self.client.switch_database(dbname)
def dropdb(self, dbname):
print("DROP database: " + dbname)
self.client.drop_database(dbname)
def dropmeas(self, measname):
print("DROP MEASUREMENT: " + measname)
self.client.query('DROP MEASUREMENT '+measname)
def assign_timestamp(self, df):
steps = df['measTimeStampRf'].unique()
for timestamp in steps:
d = df[df['measTimeStampRf'] == timestamp]
d.index = pd.date_range(start=datetime.datetime.now(), freq='1ms', periods=len(d))
self.client.write_points(d, self.meas)
time.sleep(0.7)
def populatedb():
# inintiate connection and create database UEDATA
db = INSERTDATA()
df = pd.read_csv('ue.csv')
while True:
db.assign_timestamp(df)
if __name__ == "__main__":
populatedb()
and this is container log:
[httpd] 10.244.0.1 - admin [01/Dec/2023:05:27:38 +0000] "POST /write?db=RIC_Test HTTP/1.1" 204 0 "-" "python-requests/2.23.0" 577fe481-900a-11ee-87ed-0a4914573a6e 1708
[httpd] 10.244.0.1 - admin [01/Dec/2023:05:27:39 +0000] "POST /write?db=RIC_Testt HTTP/1.1" 204 0 "-" "python-requests/2.23.0" 57c2d326-900a-11ee-87ee-0a4914573a6e 2013
[httpd] 10.244.0.1 - - [01/Dec/2023:05:27:39 +0000] "GET /ping HTTP/1.1" 204 0 "-" "kube-probe/1.16" 57d5cabe-900a-11ee-87ef-0a4914573a6e 32
[httpd] 10.244.0.1 - admin [01/Dec/2023:05:27:39 +0000] "POST /write?db=RIC_TestHTTP/1.1" 204 0 "-" "python-requests/2.23.0" 5806151c-900a-11ee-87f0-0a4914573a6e 2179
This is config:
[influxdb]
host = 10.244.0.93
port = 8086
user = admin
password = 1234
path =
database = RIC_Test
measurement = UEReports
ssl = False
[features]
thpt = DRB.UEThpDl
rsrp = RF.serving.RSRP
rsrq = RF.serving.RSRQ
rssinr = RF.serving.RSSINR
prb_usage = RRU.PrbUsedDl
ue = ue-id
anomaly = Viavi.UE.anomalies
a1_param = thp_threshold
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python script's config(), connect(), and assign_timestamp() methods, then compare the configured database and measurement with the database names shown in the container logs. Inspect the write_points calls and the database query used to check results. Done means the script writes records to the intended database and the UEReports measurement returns them when queried.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes, pandas, python
- Domain
- database, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100