Created
August 20, 2012 19:25
-
-
Save BigBlueHat/3406951 to your computer and use it in GitHub Desktop.
sql2couch beer data import scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This code was used to import the openbeerdatabase.com data into .json docs onto the filesystem. | |
| This fork of sql2couchdb was used: | |
| https://github.com/BigBlueHat/sql2couchdb/tree/bulk_insert_batches | |
| Plus a few .json sql2couchdb mappings in this repo. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "query": "SELECT beers.*, CONCAT('beer_', REPLACE(beers.name, ' ', '_')) AS beer_name, breweries.name as brewery_name, breweries.city as brewery_city, breweries.state as brewery_state, breweries.country as brewery_country, breweries.code as brewery_code, cat_name, style_name FROM `beers` LEFT JOIN categories ON beers.cat_id = categories.id LEFT JOIN styles ON beers.style_id = styles.id LEFT JOIN breweries ON beers.brewery_id = breweries.id", | |
| "doc": { | |
| "_id": "beer_name", | |
| "brewery": "brewery_name", | |
| "name": "name", | |
| "abv": "abv", | |
| "ibu": "ibu", | |
| "srm": "srm", | |
| "upc": "upc", | |
| "description": "descript", | |
| "category": "cat_name", | |
| "style": "style_name", | |
| "updated": "last_mod" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "query": "SELECT *, CONCAT('brewery_', REPLACE(breweries.name, ' ', '_')) as brewery_name FROM breweries LEFT JOIN breweries_geocode ON breweries_geocode.brewery_id = breweries.id", | |
| "doc": { | |
| "_id": "brewery_name", | |
| "name": "name", | |
| "address": ["address1", "address2"], | |
| "city": "city", | |
| "state": "state", | |
| "code": "code", | |
| "country": "country", | |
| "phone": "phone", | |
| "website": "website", | |
| "description": "descript", | |
| "geo": { | |
| "loc": ["longitude","latitude"], | |
| "accuracy": "accuracy" | |
| }, | |
| "updated": "last_mod" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment