{"id":13905478,"url":"https://github.com/spuder/csv2influxdb","last_synced_at":"2025-03-21T09:32:06.016Z","repository":{"id":21990718,"uuid":"25315712","full_name":"spuder/csv2influxdb","owner":"spuder","description":"Converts a CSV file into json for influxdb","archived":false,"fork":false,"pushed_at":"2015-05-04T15:24:41.000Z","size":162,"stargazers_count":28,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-01T04:51:16.576Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spuder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-16T18:30:44.000Z","updated_at":"2023-07-19T17:44:44.000Z","dependencies_parsed_at":"2022-08-20T04:21:25.397Z","dependency_job_id":null,"html_url":"https://github.com/spuder/csv2influxdb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spuder%2Fcsv2influxdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spuder%2Fcsv2influxdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spuder%2Fcsv2influxdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spuder%2Fcsv2influxdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spuder","download_url":"https://codeload.github.com/spuder/csv2influxdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130278,"owners_count":20402753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T23:01:16.645Z","updated_at":"2025-03-21T09:32:05.744Z","avatar_url":"https://github.com/spuder.png","language":"Ruby","readme":"\ncsv2influxdb\n============\n[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/spuder/csv2influxdb?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nConverts a CSV file into JSON for [influxdb](http://influxdb.com/)\n\n## Usage\n\nPass in `--help` for full options\n\n    -d, --database      Influxdb database name (Required)\n    -i, --in            CSV filename to read in\n    -o, --out           JSON filename to output to \n    -p, --pretty        Output pretty formatted json\n    -h, --help          Display this help message.\n\n## Installation\n\n    gem install csv2influxdb\n    \nor\n\n    git clone https://github.com/spuder/csv2influxdb.git\n    bundle install\n    \nTested with ruby 2.0.0 on OSX, if you encounter issues with any other versions, please open a github issue\n\n## What it does\n\nTakes a csv:\n\n|year|internet-explorer-usage|murders-per-capita|\n|----|-----|----|\n|2014|67|60|\n|2015|51|55|\n|2016|42|45|\n\n\n\nOutputs json with influxdb table headers (name,columns,points)\n\n```\n{\n    \"name\": \"murders\",\n    \"columns\": [\n        \"year\",\n        \"internet-explorer-usage\",\n        \"murders-per-capita\"\n    ],\n    \"points\": [\n        [\n            \"2014\",\n            \"67\",\n            \"60\"\n        ],\n        [\n            \"2015\",\n            \"51\",\n            \"55\"\n        ],\n        [\n            \"2016\",\n            \"42\",\n            \"45\"\n        ]\n    ]\n}\n```\n\n\n\n## Examples\n\n\n\n\n#####From CSV file, to JSON file\n\n    csv2influxdb -d derp -i murders.csv -o /tmp/influxdb_murders.json\n\n#####Use  stdin -\u003e stdout\n```\necho '\"year\",\"internet_explorer_usage\",\"murders_per_capita\"\n2004,67,60\n2005,51,55\n2006,42,45' | csv2influxdb -d derp\n{\"name\":\"derp\",\"columns\":[\"year\",\"internet_explorer_usage\",\"murders_per_capita\"],\"points\":[[\"2004\",\"67\",\"60\"],[\"2005\",\"51\",\"55\"],[\"2006\",\"42\",\"45\"]]}\n```\nObviously the stdin/stdout option won't work well for large amounts of data\n\n#####Pretty\n\n    csv2influxdb -p -d derp -i foo.csv -o /tmp/bar.json\n\nAvoid using `-p` unnecessarily since it wastes network bandwidth\n\n\n## Migrating Data\n\n- Export data from your relational database to csv. \n- Use `csv2influxdb`to convert to json\n- Use a tool like [influxdb-backup](https://github.com/eckardt/influxdb-backup) to import push to influxdb\n\n## Why\n\nThere are plently of online csv to json converters, why not just use that one? \n\nI tried all the online converters ([this is the best one](http://www.convertcsv.com/csv-to-json.htm)), but none of them could quite convert a csv into json that was compatible with influxdb. (no column headers, no json with multiple keys)\n\n\n\n###Legal\ncsv2influxdb is created by spuder, a fan of influxdb. It comes with no guarantee. It is a community project and is not supported nor afiliated with the creators of [influxdb](http://influxdb.com/).  \n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspuder%2Fcsv2influxdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspuder%2Fcsv2influxdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspuder%2Fcsv2influxdb/lists"}