You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During development and testing of targets, it would be useful to have access to a dry-run flag. In dry-run mode the target would operate as normal except without making any write actions. E.g.
defbulk_insert_records(
self,
full_table_name: str,
schema: dict,
records: Iterable[Dict[str, Any]],
) ->Optional[int]:
"""Bulk insert records to an existing destination table. The default implementation uses a generic SQLAlchemy bulk insert operation. This method may optionally be overridden by developers in order to provide faster, native bulk uploads. Args: full_table_name: the target table name. schema: the JSON schema for the new table, to be used when inferring column names. records: the input records. Returns: True if table exists, False if not, None if unsure or undetectable. """insert_sql=self.generate_insert_statement(
full_table_name,
schema,
)
ifisinstance(insert_sql, str):
insert_sql=sqlalchemy.text(insert_sql)
conformed_records= (
[self.conform_record(record) forrecordinrecords]
ifisinstance(records, list)
else (self.conform_record(record) forrecordinrecords)
)
self.logger.info("Inserting with SQL: %s", insert_sql)
ifnotself.dry_run: # only actually upload records if not in dry-run modeself.connector.connection.execute(insert_sql, conformed_records)
returnlen(conformed_records) ifisinstance(conformed_records, list) elseNone
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
During development and testing of targets, it would be useful to have access to a dry-run flag. In dry-run mode the target would operate as normal except without making any write actions. E.g.
Beta Was this translation helpful? Give feedback.
All reactions