Module lunar.ml.aidp_service

Classes

class AIDPService (config: Config)

Methods

def copy_table_to_s3(self, database_name: str, table_name: str, db_type: str, operation: str, target_name: str = None, s3_dt: str = None, bq_table_partition: str = None, write_type: str = 'json', max_num_files: int = 20) ‑> Dict[str, Any]

Copy a table from AIDP BigQuery to BAP S3 and Database.

Args

  • database_name: (str) Database name of Bigquery
  • table_name: (str) Name of a table on Bigquery
  • db_type: (str) Type of database to be loaded on BAP ('dynamodb' | 'docdb' | 'es' | 's3')
  • operation: (str) Type of operation ('put' (db_type 's3' is only available on 'put') | 'update' | 'upsert' (only for db_type 'dynamodb') | 'delete')
  • target_name: (optional) (str) Target name on database to be loaded (Default: Value of table_name)
  • s3_dt: (optional) (str) Set a dt partition on BAP S3. If db_type is docdb, it is necessary
  • bq_table_partition: (optional) (str) Partition value of table on BigQuery
  • write_type: (optional) Write type ((default) 'json' | 'parquet')
  • max_num_files: (optional) (int) Maximum number of files to be saved on AWS S3 (default: 10)

Returns

dict

Example

response = copy_table_to_s3(
    database_name="apollo",
    table_name="test_table",
    db_type="dynamodb",
    operation="put",
    target_name="test_data",
    s3_dt="20211101",
    write_type="json"
    bq_table_partition="2021-09-01",
)