Skip to content

Commit bd2907c

Browse files
committed
Add more types to test
1 parent 649ec13 commit bd2907c

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

packages/sqlalchemy-bigquery/scripts/load_test_data.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ bq rm -f -t test_pybigquery.sample
55
bq rm -f -t test_pybigquery.sample_one_row
66
bq rm -f -t test_pybigquery.sample_dml
77
bq rm -f -t test_pybigquery_location.sample_one_row
8+
bq rm -f -t test_pybigquery.test_table_create
9+
bq rm -f -t test_pybigquery.test_table_create2
810

911
bq mk --table --schema=$(dirname $0)/schema.json --time_partitioning_field timestamp --clustering_fields integer,string test_pybigquery.sample
1012
bq load --source_format=NEWLINE_DELIMITED_JSON --schema=$(dirname $0)/schema.json test_pybigquery.sample $(dirname $0)/sample.json

packages/sqlalchemy-bigquery/test/test_sqlalchemy_bigquery.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,31 @@ def test_dml(engine, session, table_dml):
383383
assert len(result) == 0
384384

385385

386-
def test_create_table(engine, session):
386+
def test_create_table(engine):
387+
meta = MetaData()
388+
table = Table(
389+
'test_pybigquery.test_table_create', meta,
390+
Column('integer_c', sqlalchemy.Integer),
391+
Column('float_c', sqlalchemy.Float),
392+
Column('decimal_c', sqlalchemy.DECIMAL),
393+
Column('string_c', sqlalchemy.String),
394+
Column('text_c', sqlalchemy.Text),
395+
Column('boolean_c', sqlalchemy.Boolean),
396+
Column('timestamp_c', sqlalchemy.TIMESTAMP),
397+
Column('datetime_c', sqlalchemy.DATETIME),
398+
Column('date_c', sqlalchemy.DATE),
399+
Column('time_c', sqlalchemy.TIME),
400+
Column('binary_c', sqlalchemy.BINARY)
401+
)
402+
meta.create_all(engine)
403+
404+
# Test creating tables with declarative_base
387405
Base = declarative_base()
388406

389-
class Table(Base):
390-
__tablename__ = 'test_pybigquery.test_table_create'
391-
integer_c = Column(sqlalchemy.Integer)
407+
class TableTest(Base):
408+
__tablename__ = 'test_pybigquery.test_table_create2'
409+
integer_c = Column(sqlalchemy.Integer, primary_key=True)
392410
float_c = Column(sqlalchemy.Float)
393-
text_c = Column(sqlalchemy.Text)
394-
binary_c = Column(sqlalchemy.BINARY)
395-
decimal_c = Column(sqlalchemy.DECIMAL)
396411

397412
Base.metadata.create_all(engine)
398413

0 commit comments

Comments
 (0)