Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
variable.macros28 linesDownload Raw Back to macros
1{####################################################}2{# This will be specific macro for Role objects     #}3{####################################################}4{% macro APPLY(conn, database, role, param, value) -%}5{% set exclude_quoting = ['search_path'] %}6ALTER {% if role %}ROLE {{ self.conn|qtIdent(role) }}{% if database %} IN DATABASE {{ conn|qtIdent(database) }}{% endif %}{% else %}DATABASE {{ conn|qtIdent(database) }}{% endif %}7 8    SET {{ conn|qtIdent(param) }} TO {% if param in exclude_quoting %}{{ value }}{% else %}{{ value|qtLiteral(conn) }}{% endif %};9{%- endmacro %}10{% macro RESET(conn, database, role, param) -%}11ALTER {% if role %}ROLE {{ self.conn|qtIdent(role) }}{% if database %} IN DATABASE {{ conn|qtIdent(database) }}{% endif %}{% else %}DATABASE {{ conn|qtIdent(database) }}{% endif %}12 13    RESET {{ conn|qtIdent(param) }};14{%- endmacro %}15{################################################}16{# This will be generic macro for other objects #}17{################################################}18{% macro SET(conn, object_type, object_name, options) -%}19ALTER {{object_type}} {{ conn|qtIdent(object_name) }}20    SET ({% for opt in options %}{% if loop.index != 1 %}21, {% endif %}{{ conn|qtIdent(opt.name) }}={{ opt.value }}{% endfor %});22{%- endmacro %}23{% macro UNSET(conn, object_type, object_name, options) -%}24ALTER {{object_type}} {{ conn|qtIdent(object_name) }}25    RESET ({% for opt in options %}{% if loop.index != 1 %}26, {% endif %}{{ conn|qtIdent(opt.name) }}{% endfor %});27{%- endmacro %}28 
codekingpro/portable-devtools · Team Ai