MySQLDestination
class MySQLDestination(
uri: str,
destination_table: List[str] | str,
credentials: UserPasswordCredentials = None,
if_table_exists: IfTableExistStrategySpec = 'append',
)
Bases: DestinationPlugin
Categories: destination
MySQL-based data outputs.
Initializes the MySQLDestination with the given URI and destination table, and optionally connection credentials.
Parameters
uriThe URI of the database where the data is going to be stored.
destination_tableThe tables to create. If multiple tables are provided, they must be provided as a list.
credentialsThe credentials required to access the MySQL database. Must be a UserPasswordCredentials object.
Raises
OutputConfigurationError
Properties
credentialsUserPasswordCredentialsThe credentials required to access the MySQLDatabase.
destination_tablestr | List[str]The table(s) to create. If multiple tables are provided, they must be provided as a list.
if_table_existsIfTableExistStrategySpecstr: The strategy to follow when the table already exists.
uristrThe URI of the database where the data is going to be stored.
Methods
chunkdef chunk(working_dir: str, *results: LazyFrame | None) -> list[str | None]
Store the results in the SQL destination.
Parameters:
working_dirstrThe working directory where the results will be stored.
resultslist[pl.LazyFrame | None]The results to store in the SQL destination.
writedef write(files: list[str | None])
Given a file or a list of files, write to the desired destination. Note: this method might materialize the data in the files it receives, so chunks should be of an appropriate size.
Parameters:
filesstrThe file or files to be stored in the final destination.