airflow.providers.common.sql.dialects.dialect

Attributes

T

Classes

Dialect

Generic dialect implementation.

Module Contents

airflow.providers.common.sql.dialects.dialect.T[source]
class airflow.providers.common.sql.dialects.dialect.Dialect(hook, **kwargs)[source]

Bases: airflow.utils.log.logging_mixin.LoggingMixin

Generic dialect implementation.

pattern[source]
hook: airflow.providers.common.sql.hooks.sql.DbApiHook[source]
property placeholder: str[source]
property inspector: sqlalchemy.engine.Inspector[source]
property insert_statement_format: str[source]
property replace_statement_format: str[source]
property escape_word_format: str[source]
property escape_column_names: bool[source]
escape_word(word)[source]

Escape the word if necessary.

If the word is a reserved word or contains special characters or if the escape_column_names property is set to True in connection extra field, then the given word will be escaped.

Parameters:

word (str) – Name of the column

Returns:

The escaped word

Return type:

str

unescape_word(word)[source]

Remove escape characters from each part of a dotted identifier (e.g., schema.table).

Parameters:

word (str | None) – Escaped schema, table, or column name, potentially with multiple segments.

Returns:

The word without escaped characters.

Return type:

str | None

classmethod extract_schema_from_table(table)[source]
get_column_names(table, schema=None, predicate=lambda column: ...)[source]
get_target_fields(table, schema=None)[source]
get_primary_keys(table, schema=None)[source]
run(sql, autocommit=False, parameters=None, handler=None, split_statements=False, return_last=True)[source]
get_records(sql, parameters=None)[source]
property reserved_words: set[str][source]
generate_insert_sql(table, values, target_fields, **kwargs)[source]

Generate the INSERT SQL statement.

Parameters:
  • table – Name of the target table

  • values – The row to insert into the table

  • target_fields – The names of the columns to fill in the table

Returns:

The generated INSERT SQL statement

Return type:

str

generate_replace_sql(table, values, target_fields, **kwargs)[source]

Generate the REPLACE SQL statement.

Parameters:
  • table – Name of the target table

  • values – The row to insert into the table

  • target_fields – The names of the columns to fill in the table

Returns:

The generated REPLACE SQL statement

Return type:

str

Was this entry helpful?