https://github.com/redhog/swissarmykitchensink
Swiss army kitchen sink for all things to do with database queries and data conversion / editing from the command line.
https://github.com/redhog/swissarmykitchensink
Last synced: over 1 year ago
JSON representation
Swiss army kitchen sink for all things to do with database queries and data conversion / editing from the command line.
- Host: GitHub
- URL: https://github.com/redhog/swissarmykitchensink
- Owner: redhog
- Created: 2013-02-27T15:29:22.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2016-01-27T14:06:35.000Z (over 10 years ago)
- Last Synced: 2025-03-28T17:57:40.279Z (over 1 year ago)
- Language: Python
- Homepage: http://redhog.org/db_export
- Size: 24.4 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# db_export
A simple utility to export and import CSV data to/from any sql database supported by a DB API 2.0 compatible python library.
Usage:
db_export.py expr="select * from foo" > file.csv
db_export.py expr="insert into foo (bar, fie) values(%(bar)s, %(fie)s)" < file.csv
Other parameters:
conn=psycopg2
conn=pyPgSQL.PgSQL
conn=MySQLdb
format=kml
Connection parameters (same name as to the connect() function of the respective driver:
host=localhost
user=username
passwd=password
db=dbname
# skyconvert
Converts between various data list containers. Supported formats:
json (list containing objects)
geojson (features with properties)
csv (optionally containing json in some columns)
Can for example be used to convert between Pybossa tasks.json format and a geojson
container format allowing you to sort through and filter the tasks visually in
e.g. QGis, and then convert them back for import into Pybossa.
Usages:
convert.py INFILE OUTFILE
Examples:
convert.py tasks.json tasks.geojson
convert.py tasks.geojson tasks.json
convert.py tasks.geojson tasks.csv
convert.py tasks.csv tasks.json
# jsonedit
Edits json files using jsonpaths
For more information on jsonpaths see http://goessner.net/articles/JsonPath/
There are three possible usages:
jsonedit.py infile.json outfile.json '$..bbox'
This will compile a list of all bbox attribute values
jsonedit.py infile.json outfile.json '$..options' '{"layer": "47-11"}'
This will replace all options attribute values with the json object {"layer": "47-11"}
jsonedit.py infile.json outfile.json '$..bbox' delete
This will delete all bbox attributes