当JSON是源格式时,从地面军事系统到BQ操作员的操作失败

2024-10-03 02:35:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个GoogleCloudStorageToBigQueryOperator操作员在dag中运行气流。它在处理CSV文件时工作得非常完美。。。我现在尝试接收一个JSON文件,并收到错误:例如:

skipLeadingRows is not a valid src_fmt_configs for type NEWLINE_DELIMITED_JSON

奇怪的是,我没有在我的通话中呼叫skipLeadingRows。详情如下:

 load_Users_to_GBQ = GoogleCloudStorageToBigQueryOperator(
    task_id='Table1_GCS_to_GBQ',
    bucket='bucket1',
    source_objects=['table*.json'],
    source_format='NEWLINE_DELIMITED_JSON',
    destination_project_dataset_table='DB.table1',
    autodetect=False,
    schema_fields=[
        {'name': 'fieldid', 'type': 'integer', 'mode': 'NULLABLE'},
        {'name': 'filed2', 'type': 'integer', 'mode': 'NULLABLE'},
        {'name': 'field3', 'type': 'string', 'mode': 'NULLABLE'},
        {'name': 'field4', 'type': 'string', 'mode': 'NULLABLE'},
        {'name': 'field5', 'type': 'string', 'mode': 'NULLABLE'}
    ],
    write_disposition='WRITE_TRUNCATE',
    google_cloud_storage_conn_id='Conn1',
    bigquery_conn_id='Conn1',
    dag=dag)

我错过了什么? 谢谢


Tags: 文件tonameidjsonstringmodetype