Skip to content

Commit f02380b

Browse files
committed
Fix explicit schema resolution
1 parent c508ea2 commit f02380b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sdks/python/apache_beam/io/external/xlang_jdbcio_it_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import apache_beam as beam
3232
from apache_beam import coders
33+
from apache_beam.io import jdbc
3334
from apache_beam.io.jdbc import ReadFromJdbc
3435
from apache_beam.io.jdbc import WriteToJdbc
3536
from apache_beam.options.pipeline_options import StandardOptions
@@ -82,7 +83,13 @@
8283
("renamed_time", datetime.time),
8384
],
8485
)
85-
coders.registry.register_row(CustomSchemaRow)
86+
87+
# Need to put inside enforce_millis_instant_for_timestamp context to align
88+
# with the same setup in ReadFromJdbc.__init__. Remove once Beam moved to
89+
# micros instant for timestamp
90+
# Alternatively, use coders.registry.register_coder(CustomSchemaRow, RowCoder)
91+
with jdbc.enforce_millis_instant_for_timestamp():
92+
coders.registry.register_row(CustomSchemaRow)
8693

8794
SimpleRow = typing.NamedTuple(
8895
"SimpleRow", [("id", int), ("name", str), ("value", float)])

0 commit comments

Comments
 (0)