{"id":15060792,"url":"https://github.com/nealwp/blobview","last_synced_at":"2026-02-27T00:02:29.055Z","repository":{"id":190838699,"uuid":"683260246","full_name":"nealwp/blobview","owner":"nealwp","description":"Generate BigQuery SQL views from JSON","archived":false,"fork":false,"pushed_at":"2023-10-21T01:54:08.000Z","size":442,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-02T02:42:05.777Z","etag":null,"topics":["bigquery","cli","json","sql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nealwp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-26T02:24:53.000Z","updated_at":"2023-08-26T21:06:58.000Z","dependencies_parsed_at":"2023-08-26T17:22:30.925Z","dependency_job_id":"5fdf5416-a3ba-497b-8462-619d88b5f00b","html_url":"https://github.com/nealwp/blobview","commit_stats":null,"previous_names":["nealwp/blobview"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nealwp/blobview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nealwp%2Fblobview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nealwp%2Fblobview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nealwp%2Fblobview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nealwp%2Fblobview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nealwp","download_url":"https://codeload.github.com/nealwp/blobview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nealwp%2Fblobview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29878270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"ssl_error","status_checked_at":"2026-02-26T23:50:46.793Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bigquery","cli","json","sql"],"created_at":"2024-09-24T23:04:41.689Z","updated_at":"2026-02-27T00:02:29.033Z","avatar_url":"https://github.com/nealwp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blobview  \n\u003e Generate BigQuery SQL views from JSON \n\n[![npm version](https://badgen.net/npm/v/@nealwp/blobview)](https://www.npmjs.com/package/@nealwp/blobview)\n![tests](https://github.com/nealwp/blobview/actions/workflows/test.yml/badge.svg)\n![build](https://github.com/nealwp/blobview/actions/workflows/build.yml/badge.svg)\n\nThis CLI tool reads a JSON file and produces BigQuery compatible SQL views from the given JSON. It assumes you have a JSON blob column in a BigQuery dataset that you will reference with the created view.\n\n## Usage\n\n```bash\nnpx @nealwp/blobview@latest [options] \u003cfilepath\u003e \n```\n\n```text\nArguments:\n  filepath      path to valid JSON file\n\nOptions:\n  -t TABLE, --table=TABLE           specify a table name to use in FROM clause. default: \"\u003ctable\u003e\"\n  -d DATASET, --dataset=DATASET     specify a dataset to use in FROM clause. default: \"\u003cdataset\u003e\" \n  -h, --help                        show help\n```\n\n## Examples:\nDefault output to STDOUT:\n```bash\nnpx @nealwp/blobview ./path/to/file.json\n```\n\nDataset and table as input options:\n```bash\nnpx @nealwp/blobview --dataset=myDataset --table=myTable ./path/to/file.json\n# shorthand options\nnpx @nealwp/blobview -d myDataset -t myTable ./path/to/file.json\n```\n\nRedirect output to file:\n```bash\nnpx @nealwp/blobview@latest ./path/to/file.json \u003e my-view-file.sql\n```\n\n## Features\n* Produces valid BigQuery syntax SQL\n* Creates separate query for each nested object\n* Detects STRING, DECIMAL, and INTEGER types from JSON data and casts column datatypes accordingly\n* Detects GeoJSON Feature Collection type and formats to JSON string\n* Auto-formats column names to snake_case from camelCase and PascalCase\n* Detects deeply-nested objects and formats to JSON string\n* Pre-populates FROM clause with BigQuery-style placeholders\n* BigQuery dataset and table name can be supplied as input options\n\n## Limitations\n* Does not detect DATE or TIMESTAMP types, or other types like BOOLEAN\n* Arrays will get formatted as JSON strings\n* Assumes the BigQuery source dataset column name is always `json_blob`\n* Does not create SQL views in any syntax other than BigQuery\n* Requires a local JSON file to read\n* Does not include option to write queries to separate files instead of STDOUT\n* BigQuery project name cannot be supplied as input\n\n## Example Output\n\n```jsonc\n// sample-data.json\n{\n  \"stringField\": \"any string goes here\",\n  \"integerField\": 1234,\n  \"decimalField\": 3.1234,\n  \"childField1\": {\n      \"gender\": \"male\",\n      \"latitude\": 32.667598\n  },\n  \"childField2\": {\n      \"favoriteFruit\": \"banana\",\n      \"longitude\": 4.219472\n  },\n  \"childWithNestedObject\": {\n      \"isNormal\": \"i sure hope so\",\n      \"nestedObject\": {\n        \"favoritePhilosopher\": \"Kant\", \n        \"shoeSize\": 14.5\n    },\n  },\n  \"examplGeoJson\": {\n    \"type\": \"FeatureCollection\",\n    \"features\": [\n      {\n        \"type\": \"Feature\",\n        \"id\": 16,\n        \"geometry\": {\n          \"type\": \"Polygon\",\n          \"coordinates\": [\n            [\n              [-32.667598, -4.239272],\n              [-32.767999, -4.319272]\n            ]\n          ]\n        }\n      }\n    ]\n  }\n}\n```\n\n```bash\n# terminal command\nnpx @nealwp/blobview sample-data.json\n```\n\nThe above command will produce the following output:\n\n```sql\n/* stdout */\nSELECT\n    CAST(JSON_VALUE(json_blob.stringField) as STRING) as string_field\n    , CAST(JSON_VALUE(json_blob.integerField) as INTEGER) as integer_field\n    , CAST(JSON_VALUE(json_blob.decimalField) as DECIMAL) as decimal_field\n    , TO_JSON_STRING(json_blob.exampleGeoJson) as example_geo_json \nFROM \u003cproject\u003e.\u003cdataset\u003e.\u003ctable\u003e\n/**/\nSELECT\n    CAST(JSON_VALUE(json_blob.childField1.gender) as STRING) as gender \n    , CAST(JSON_VALUE(json_blob.childField1.latitude) as DECIMAL) as latitude \nFROM \u003cproject\u003e.\u003cdataset\u003e.\u003ctable\u003e\n/**/\nSELECT\n    CAST(JSON_VALUE(json_blob.childField2.favoriteFruit) as STRING) as favorite_fruit \n    , CAST(JSON_VALUE(json_blob.childField2.longitude) as DECIMAL) as longitude \nFROM \u003cproject\u003e.\u003cdataset\u003e.\u003ctable\u003e\n/**/\nSELECT\n    CAST(JSON_VALUE(json_blob.childWithNestedObject.isNormal) as STRING) as is_normal \n    , TO_JSON_STRING(json_blob.childWithNestedObject.nestedObject) as nested_object \nFROM \u003cproject\u003e.\u003cdataset\u003e.\u003ctable\u003e\n```\n\n```bash\n# terminal command with input options\nnpx @nealwp/blobview --dataset=myDataset --table=myTable sample-data.json\n```\n\nWill produce the following output:\n\n```sql\n/* stdout */\nSELECT\n    CAST(JSON_VALUE(json_blob.stringField) as STRING) as string_field\n    , CAST(JSON_VALUE(json_blob.integerField) as INTEGER) as integer_field\n    , CAST(JSON_VALUE(json_blob.decimalField) as DECIMAL) as decimal_field\n    , TO_JSON_STRING(json_blob.exampleGeoJson) as example_geo_json \nFROM \u003cproject\u003e.myDataset.myTable\n/**/\nSELECT\n    CAST(JSON_VALUE(json_blob.childField1.gender) as STRING) as gender \n    , CAST(JSON_VALUE(json_blob.childField1.latitude) as DECIMAL) as latitude \nFROM \u003cproject\u003e.myDataset.myTable\n/**/\nSELECT\n    CAST(JSON_VALUE(json_blob.childField2.favoriteFruit) as STRING) as favorite_fruit \n    , CAST(JSON_VALUE(json_blob.childField2.longitude) as DECIMAL) as longitude \nFROM \u003cproject\u003e.myDataset.myTable\n/**/\nSELECT\n    CAST(JSON_VALUE(json_blob.childWithNestedObject.isNormal) as STRING) as is_normal \n    , TO_JSON_STRING(json_blob.childWithNestedObject.nestedObject) as nested_object \nFROM \u003cproject\u003e.myDataset.myTable\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnealwp%2Fblobview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnealwp%2Fblobview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnealwp%2Fblobview/lists"}