GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python-bigquery/tests/system/test_structs.py at main · bmwant/python-bigquery Expand file tree/ Copy pathtest_structs.pyMore file actions 32 lines (26 loc) · 998 Bytes / Copy pathtest_structs.pyFile metadata and controls32 lines (26 loc) · 998 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 import datetime import pytest from google.cloud.bigquery.dbapi import connect person_type = "struct<name string," " children array<struct<name string, bdate date>>>" person_type_sized = ( "struct<name string(22)," " children array<struct<name string(22), bdate date>>>" ) @pytest.mark.parametrize("person_type_decl", [person_type, person_type_sized]) def test_structs(bigquery_client, dataset_id, person_type_decl, table_id): conn = connect(bigquery_client) cursor = conn.cursor() cursor.execute(f"create table {table_id} (person {person_type_decl})") data = dict( name="par", children=[ dict(name="ch1", bdate=datetime.date(2021, 1, 1)), dict(name="ch2", bdate=datetime.date(2021, 1, 2)), ], ) cursor.execute( f"insert into {table_id} (person) values (%(v:{person_type})s)", dict(v=data), ) cursor.execute(f"select * from {table_id}") [[result]] = list(cursor) assert result == data |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |