LoadConfig¶
-
class
google_pandas_load.load_config.LoadConfig(source, destination, data_name=None, query=None, dataframe=None, write_disposition='WRITE_TRUNCATE', dtype=None, parse_dates=None, infer_datetime_format=True, date_cols=None, timestamp_cols=None, bq_schema=None)[source]¶ Bases:
objectConfiguration for a load job.
This class has the same parameters as
google_pandas_load.loader.Loader.load(). It is used to launch simultaneously load jobs as follows:A list of LoadConfig is built.
The list is passed to
google_pandas_load.loader.Loader.mload().
-
static
bq_schema_inferred_from_dataframe(dataframe, date_cols=None, timestamp_cols=None)[source]¶ Return a BigQuery schema that is inferred from a pandas dataframe.
In BigQuery, a column is given its type according to the following rule:
if its name is listed in the date_cols parameter, its type in BigQuery should be DATE.
elif its name is listed in the timestamp_cols parameter, its type in BigQuery should be TIMESTAMP.
elif its pandas dtype is equal to numpy.bool, its type in BigQuery is BOOLEAN.
elif its pandas dtype has numpy.integer dtype as ancestor, its type in BigQuery is INTEGER.
elif its pandas dtype has numpy.floating dtype as ancestor, its type in BigQuery is FLOAT.
else its type in BigQuery is STRING.
- Parameters
dataframe (pandas.DataFrame) – The dataframe.
date_cols (list of str, optional) – The names of the columns receiving the BigQuery type DATE.
timestamp_cols (list of str, optional) – The names of the columns receiving the BigQuery type TIMESTAMP.
- Returns
A BigQuery schema.
- Return type
list of google.cloud.bigquery.schema.SchemaField