我试图使用ApacheBeam的PythonSDK从postgres表中读取数据。我已经按照文档中的说明安装了JavaSDK。我正在使用最新版本。 我的守则如下:
import logging
import typing
import apache_beam as beam
from apache_beam import coders
from apache_beam.io.jdbc import ReadFromJdbc
from apache_beam.options.pipeline_options import PipelineOptions
from past.builtins import unicode
def run(argv=None):
beam_options = PipelineOptions()
ExampleRow = typing.NamedTuple('ExampleRow', [('id', int), ('name', unicode)])
coders.registry.register_coder(ExampleRow, coders.RowCoder)
with beam.Pipeline(options=beam_options) as p:
result = (
p
| 'Read from jdbc' >> ReadFromJdbc(
table_name='jdbc_external_test_read',
driver_class_name='org.postgresql.Driver',
jdbc_url='jdbc:postgresql://localhost:5432/example',
username='postgres',
password='postgres')
)
if __name__ == '__main__':
logging.getLogger(__name__).setLevel(logging.INFO)
run()
但是当我运行它时,我得到了错误ValueError: No logical type registered for URN 'beam:logical_type:javasdk:v1'
目前没有回答
相关问题 更多 >
编程相关推荐