diepvries.template_sql.sql_formulas module

SQL formulas (formatted strings).

diepvries.template_sql.sql_formulas.format_fields_for_join(fields, table_1_alias, table_2_alias)

Get formatted list of field names for SQL JOIN condition.

Parameters:
  • fields (List[Union[Field, DrivingKeyField]]) – Fields to be formatted.

  • table_1_alias (str) – Alias that should be used in the field on the left side of the equality sign.

  • table_2_alias (str) – alias that should be used in the field on the right side of the equality sign.

Return type:

List[str]

Returns:

Fields list formatted for an SQL JOIN condition.

diepvries.template_sql.sql_formulas.format_fields_for_select(fields, table_alias=None)

Get formatted list of field names for SQL SELECT statement.

Parameters:
  • fields (List[Union[Field, DrivingKeyField]]) – Fields to be formatted.

  • table_alias (Optional[str]) – Alias that should be used in each field.

Return type:

List[str]

Returns:

Fields list formatted for SQL SELECT clause.