How to use the flowetl.mixins.fixed_sql_with_params_mixin.fixed_sql_operator_with_params function in flowetl

To help you get started, we’ve selected a few flowetl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Flowminder / FlowKit / flowetl / flowetl / flowetl / operators / create_indexes_operator.py View on Github external
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from flowetl.mixins.fixed_sql_with_params_mixin import fixed_sql_operator_with_params

CreateIndexesOperator = fixed_sql_operator_with_params(
    class_name="CreateIndexesOperator",
    sql="""
                {% for index_column in params.index_columns %}
                    DROP INDEX IF EXISTS {{ table_name }}_{{ index_column }}_idx;
                    CREATE INDEX {{ table_name }}_{{ index_column }}_idx ON {{ extract_table }} ({{ index_column }});
                {% endfor %}
                """,
    params=["index_columns"],
)
github Flowminder / FlowKit / flowetl / flowetl / flowetl / operators / cluster_operator.py View on Github external
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from flowetl.mixins.fixed_sql_with_params_mixin import fixed_sql_operator_with_params

ClusterOperator = fixed_sql_operator_with_params(
    class_name="ClusterOperator",
    sql="""
                DROP INDEX IF EXISTS {{ table_name }}_{{ params.cluster_field }}_idx;
                CREATE INDEX {{ table_name }}_{{ params.cluster_field }}_idx ON {{ extract_table }} ({{ params.cluster_field }});
                CLUSTER {{ extract_table }} USING {{ table_name }}_{{ params.cluster_field }}_idx;
                """,
    params=["cluster_field"],
)
github Flowminder / FlowKit / flowetl / flowetl / flowetl / sensors / table_flux_sensor.py View on Github external
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from flowetl.mixins.fixed_sql_with_params_mixin import fixed_sql_operator_with_params

TableFluxSensor = fixed_sql_operator_with_params(
    class_name="TableFluxSensor",
    sql="""
                CREATE TEMPORARY TABLE {{ staging_table_name }}_count AS
                SELECT count(*) FROM {{ staging_table }};
                SELECT pg_sleep({{ params.flux_check_interval }});
                SELECT 1 WHERE (SELECT * FROM {{ staging_table_name }}_count) = (SELECT count(*) FROM {{ staging_table }});
                """,
    params=["flux_check_interval"],
    is_sensor=True,
)