def test_has_column() -> None: data_table = DataTable({"a": [1, 2], "b": [3, 4]}) assert data_table.has_column() assert data_table.has_column("a") assert data_table.has_column("b") assert data_table.has_column("b", "a") assert not data_table.has_column("c") assert not data_table.has_column("a", "c")
def _validate_data_table_has_table_keys(self, data_table: DataTable) -> None: for table_key in self.table_keys: if data_table.has_set_column(table_key): continue if data_table.has_column(table_key): raise DynamoQueryError( f'Column "{table_key}" has missing values in input data,' f" but present in table keys {self.table_keys}") raise DynamoQueryError( f'Column "{table_key}" is missing in input data,' f" but present in table keys {self.table_keys}")
def _validate_required_value_keys(self, data_table: DataTable) -> None: for name, expression in self._expressions.items(): required_value_keys = expression.get_format_values() for required_value_key in required_value_keys: if data_table.has_set_column(required_value_key): continue if data_table.has_column(required_value_key): raise DynamoQueryError( f'Column "{required_value_key}"" has missing values in input data,' f' but present in {name} = "{expression}"') raise DynamoQueryError( f'Column "{required_value_key}" is missing in input data,' f' but present in {name} = "{expression}"')