This is an automated email from the ASF dual-hosted git repository.

yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new e00a81f400c Allow JSON type in TableSchema for WriteToBigQuery with 
FILE_LOAD method in Python SDK (#30340)
e00a81f400c is described below

commit e00a81f400c0dc3fd72d7de43605574bf2626d6b
Author: Edward Cui <cui23...@gmail.com>
AuthorDate: Mon Feb 19 23:42:38 2024 -0500

    Allow JSON type in TableSchema for WriteToBigQuery with FILE_LOAD method in 
Python SDK (#30340)
    
    * remove JSON type checking and raise error in WriteoToBigQuery with 
FILE_LOADS method
    
    * Changing to warning instead
    
    * update warning message. Nw should be the same with Java sdk
    
    * fix lie length
    
    * fixing formatting
---
 sdks/python/apache_beam/io/gcp/bigquery.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/sdks/python/apache_beam/io/gcp/bigquery.py 
b/sdks/python/apache_beam/io/gcp/bigquery.py
index 7648ab4064d..ad9e31d5285 100644
--- a/sdks/python/apache_beam/io/gcp/bigquery.py
+++ b/sdks/python/apache_beam/io/gcp/bigquery.py
@@ -2178,13 +2178,11 @@ bigquery_v2_messages.TableSchema`. or a `ValueProvider` 
that has a JSON string,
         def find_in_nested_dict(schema):
           for field in schema['fields']:
             if field['type'] == 'JSON':
-              raise ValueError(
-                  'Found JSON type in table schema. JSON data '
-                  'insertion is currently not supported with '
-                  'FILE_LOADS write method. This is supported with '
-                  'STREAMING_INSERTS. For more information: '
-                  'https://cloud.google.com/bigquery/docs/reference/'
-                  'standard-sql/json-data#ingest_json_data')
+              logging.warning(
+                  'Found JSON type in TableSchema for "File_LOADS" write '
+                  'method. Make sure the TableSchema field is a parsed '
+                  'JSON to ensure the read as a JSON type. Otherwise it '
+                  'will read as a raw (escaped) string.')
             elif field['type'] == 'STRUCT':
               find_in_nested_dict(field)
 

Reply via email to