Skip to content

Commit

Permalink
Allow copy_kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
austinweisgrau committed Jul 31, 2024
1 parent cdb2e61 commit ed6568b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions parsons/utilities/dbt/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,15 @@ def send(self, manifests: list[Manifest]) -> None:
class dbtLoggerDatabase(dbtLogger, ABC):
"""Log dbt artifacts by loading to a database."""

def __init__(self, database_connector: DatabaseConnector, destination_table: str) -> None:
def __init__(
self,
database_connector: DatabaseConnector,
destination_table: str,
**copy_kwargs,
) -> None:
self.db_connector = database_connector
self.destination_table = destination_table
self.copy_kwargs = copy_kwargs

def format_command_result(self, manifest: Manifest) -> Table:
"""Loads all artifact results into a Parsons Table."""
Expand Down Expand Up @@ -231,4 +237,6 @@ def send(self, manifests: list[Manifest]) -> None:
self.commands = manifests
log_tbl = self.format_result()

self.db_connector.copy(log_tbl, self.destination_table, if_exists="append")
self.db_connector.copy(
log_tbl, self.destination_table, if_exists="append", **self.copy_kwargs
)

0 comments on commit ed6568b

Please sign in to comment.