json_to_sql

command
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2018 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

JSON to SQL

This directory contains a small go script that consumes single-layer .json files from stdin and outputs them as SQL INSERT statements. Each field in each record of the input is converted to a column name, and the value of that field is written to that column.

The binary takes a single argument: the name of the table that the data should be written to. For example:

$ go build to_sql.go && cat test.json | ./to_sql cars
INSERT INTO cars (year, make, model) VALUES (2005, Toyota, Corolla);
INSERT INTO cars (model, year, make) VALUES (Civic, 1998, Honda);
INSERT INTO cars (make, model, year) VALUES (Tesla, Roadster, 2008);
INSERT INTO cars (make, model, year) VALUES (Bugatti, Chiron, 2016);
INSERT INTO cars (make, model, year) VALUES (Dodge, Viper, 2015);

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL