pgcom.commuter.Commuter.is_entry_exist

Commuter.is_entry_exist(table_name: str, **kwargs: Any) bool[source]

Return True if entry already exists, otherwise return False.

Implements a simple query to verify if a specific entry exists in the table. WHERE clause is created from **kwargs.

Parameters
  • table_name – Name of the database table.

  • **kwargs – Parameters to create WHERE clause.

Examples

Implement query SELECT 1 FROM people WHERE id=5 AND num=100.

>>> self.is_entry_exist("my_table", id=5, num=100)
True