Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions spanner/tests/_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
name STRING(1024),
value INT64 )
PRIMARY KEY (name);
CREATE TABLE string_plus_array_of_string (
id INT64,
name STRING(16),
tags ARRAY<STRING(16)> )
PRIMARY KEY (id);
"""

DDL_STATEMENTS = [stmt.strip() for stmt in DDL.split(';') if stmt.strip()]
24 changes: 24 additions & 0 deletions spanner/tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,30 @@ def test_batch_insert_then_read(self):
rows = list(snapshot.read(self.TABLE, self.COLUMNS, self.ALL))
self._check_row_data(rows)

def test_batch_insert_then_read_string_array_of_string(self):
TABLE = 'string_plus_array_of_string'
COLUMNS = ['id', 'name', 'tags']
ROWDATA = [
(0, None, None),
(1, 'phred', ['yabba', 'dabba', 'do']),
(2, 'bharney', []),
(3, 'wylma', ['oh', None, 'phred']),
]
retry = RetryInstanceState(_has_all_ddl)
retry(self._db.reload)()

session = self._db.session()
session.create()
self.to_delete.append(session)

with session.batch() as batch:
batch.delete(TABLE, self.ALL)
batch.insert(TABLE, COLUMNS, ROWDATA)

snapshot = session.snapshot(read_timestamp=batch.committed)
rows = list(snapshot.read(TABLE, COLUMNS, self.ALL))
self._check_row_data(rows, expected=ROWDATA)

def test_batch_insert_then_read_all_datatypes(self):
retry = RetryInstanceState(_has_all_ddl)
retry(self._db.reload)()
Expand Down