Python 从Google云存储读取时指定读取缓冲区大小
我正在尝试使用cloudstorage library打开我在Google云存储中的一个文件。 我得到的错误是模块cloudstorage没有属性“open” 我想在将文件从Google Cloud Storage加载到Google BigQuery时指定读取缓冲区大小。这就是我希望使用的函数。这些参数需要一个类似文件的对象Python 从Google云存储读取时指定读取缓冲区大小,python,google-cloud-platform,google-cloud-storage,Python,Google Cloud Platform,Google Cloud Storage,我正在尝试使用cloudstorage library打开我在Google云存储中的一个文件。 我得到的错误是模块cloudstorage没有属性“open” 我想在将文件从Google Cloud Storage加载到Google BigQuery时指定读取缓冲区大小。这就是我希望使用的函数。这些参数需要一个类似文件的对象 Client.load_table_from_file(file_obj, destination, rewind=False, size=None, num_retrie
Client.load_table_from_file(file_obj, destination, rewind=False, size=None, num_retries=6, job_id=None, job_id_prefix=None, location=None, project=None, job_config=None)[source]
从类似文件的对象上载此表的内容
是否有其他方法将云存储文件作为对象传递给此方法?或者,在指定读取缓冲区大小的同时,用另一种方法将文件从云存储加载到Google BigQuery
from google.cloud import bigquery
from google.cloud import storage
import cloudstorage as gcs
def hello_gcs(event, context):
gcs_file = gcs.open('no-trigger/transaction.csv')
job_config = bigquery.LoadJobConfig()
job_config.autodetect = False
job_config.max_bad_records=1
job_config.create_disposition = 'CREATE_IF_NEEDED'
job_config.source_format = bigquery.SourceFormat.CSV
load_job = bclient.load_table_from_file(
gcs_file,
dataset_ref.table(temptablename),
location='asia-northeast1',
size=2147483648,
job_config=job_config) # API request
你能分享你正在尝试的代码和完整的回溯吗?嗨,添加了一段代码。你能分享你正在尝试的代码和完整的回溯吗?嗨,添加了一段代码。