2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Change CSV to have unix style line endings

The excel dialog has nice minimal quoting, but DOS line endings.

Unix dialog has good line endings, but excessive quoting.

Create a hybrid dialect and use it for nodesensors output.
This commit is contained in:
Jarrod Johnson 2021-05-13 10:38:02 -04:00
parent b74d648e7f
commit 5fea265dc8

View File

@ -32,6 +32,13 @@ path = os.path.realpath(os.path.join(path, '..', 'lib', 'python'))
if path.startswith('/opt'):
sys.path.append(path)
class hybridcsv(csv.excel):
lineterminator = '\n'
csv.register_dialect('hybrid', hybridcsv)
import confluent.client as client
sensorcollections = {
@ -209,7 +216,7 @@ def main():
headernames.append(headername)
if options.csv:
linebyline = False
csvwriter = csv.writer(sys.stdout)
csvwriter = csv.writer(sys.stdout, dialect='hybrid')
if options.interval:
csvwriter.writerow(['time', 'node'] + headernames)
else: