pgcom.commuter.Commuter.resolve_primary_conflicts

Commuter.resolve_primary_conflicts(table_name: str, data: pandas.core.frame.DataFrame, where: Optional[Union[str, psycopg2.sql.Composed]] = None) pandas.core.frame.DataFrame[source]

Resolve primary key conflicts in DataFrame.

Remove all the rows from the DataFrame conflicted with primary key constraint.

Parameter where is used to reduce the amount of querying data.

Parameters
  • table_name – Name of the table.

  • data – DataFrame where the primary key conflicts need to be resolved.

  • where – WHERE clause used when querying data from the table_name.

Returns

DataFrame without primary key conflicts.