def get_pg_sql_insert_clause(self, document_language: str,
                              python_values: List) -> SQLInsertClause:
     money = first_or_none(python_values) or self.default_value  # Dict
     currency = money.get('currency') if money else None
     amount = money.get('amount') if money else None
     return SQLInsertClause(
         '"{currency_column}", '
         '"{amount_column}"'.format(currency_column=self.currency_column,
                                    amount_column=self.amount_column), [],
         '%s, %s', [currency, amount])
 def python_values_to_single_db_value(self, python_values: List) -> Any:
     python_value = first_or_none(python_values) or self.default_value
     return bool(python_value) if python_value is not None else False
 def python_values_to_single_db_value(self, python_values: List) -> Any:
     address = first_or_none(python_values) or self.default_value  # Dict
     return str(address.get('address') or '') if address else None
 def python_values_to_single_db_value(self, python_values: List) -> Any:
     python_value = first_or_none(python_values) or self.default_value
     return python_value if type(python_value) is date \
         else python_value.date() if type(python_value) is datetime \
         else None
 def python_values_to_single_db_value(self, python_values: List) -> Any:
     python_value = first_or_none(python_values) or self.default_value
     return float(python_value) if python_value else None
 def python_values_to_single_db_value(self,
                                      python_values: List) -> Optional[str]:
     return first_or_none(python_values) or self.default_value
Esempio n. 7
0
 def python_values_to_single_db_value(self, python_values: List) -> Any:
     python_value = first_or_none(python_values)
     return int(python_value) if python_value else None
Esempio n. 8
0
 def python_values_to_single_db_value_for_text_search(
         self, python_values: List) -> Optional[str]:
     return first_or_none(python_values)