We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm in a project that uses a metadata column of type repeated record:
bq show project:dataset.table ... +- metadata: record (repeated) | |- name: string (required) | |- value: string
I've been able to create our table with bigquery-emulator but I'm not able to get the values properly from the metadata column.
./bigquery-emulator --project=test_project --log-level=debug # ... bq --api http://0.0.0.0:9050 mk --project_id=test_project --dataset test_dataset bq --api http://0.0.0.0:9050 mk --project_id=test_project --table test_project:test_dataset.test_metadata ./metadata_schema.json bq --api http://0.0.0.0:9050 show --project_id=test_project --schema test_project:test_dataset.test_metadata # [{"fields":[{"mode":"REQUIRED","name":"name","type":"STRING"},{"mode":"NULLABLE","name":"value","type":"STRING"}],"mode":"REPEATED","name":"metadata","type":"RECORD"}] bq --api http://0.0.0.0:9050 query --project_id=test_project 'INSERT INTO test_dataset.test_metadata (metadata) VALUES (ARRAY[ STRUCT("FOO","BAR") ])' bq --api http://0.0.0.0:9050 query --project_id=test_project 'SELECT * FROM test_dataset.test_metadata' # +--------------+ # | metadata | # +--------------+ # | [{"":"BAR"}] | # +--------------+
The schema file is as follows:
[ { "fields": [ { "mode": "REQUIRED", "name": "name", "type": "STRING" }, { "mode": "NULLABLE", "name": "value", "type": "STRING" } ], "mode": "REPEATED", "name": "metadata", "type": "RECORD" } ]
and when I query our test table, I get:
+-----------+-----------------------------------------+ | service | metadata | +-----------+-----------------------------------------+ | XxxxXxxx | [{"name":"NNNNNNN","value":"VVVVVVV1"}] | | XxxxXxxx | [{"name":"NNNNNNN","value":"VVVVVVV2"}] | +-----------+-----------------------------------------+
Am I doing the insert correctly and can I achieve the same result as google bigquery?
The text was updated successfully, but these errors were encountered:
Thank you for your report ! I fixed this problem with v0.1.21 . Please confirm it 😄
Sorry, something went wrong.
Thank you @goccy! The simple test passes now perfectly. I'll try to finish the service integration in docker-compose next 👍
... bq --api http://0.0.0.0:9050 query --project_id=test_project 'INSERT INTO test_dataset.test_metadata (mmetadata) VALUES (ARRAY[ STRUCT("FOO","BAR") ])' bq --api http://0.0.0.0:9050 query --project_id=test_project 'SELECT * FROM test_dataset.test_metadata' # +--------------------------------+ # | metadata | # +--------------------------------+ # | [{"name":"FOO","value":"BAR"}] | # +--------------------------------+
Successfully merging a pull request may close this issue.
Hi, I'm in a project that uses a metadata column of type repeated record:
I've been able to create our table with bigquery-emulator but I'm not able to get the values properly from the metadata column.
The schema file is as follows:
and when I query our test table, I get:
Am I doing the insert correctly and can I achieve the same result as google bigquery?
The text was updated successfully, but these errors were encountered: