init
This commit is contained in:
22
dbt/macros/m_current_timestamp.sql
Normal file
22
dbt/macros/m_current_timestamp.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
{% macro m_current_timestamp(type) %}
|
||||
|
||||
{% if type | lower == 'db' %}
|
||||
|
||||
{% if execute %}
|
||||
|
||||
{% set get_timestamp %}
|
||||
SELECT to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL
|
||||
{% endset %}
|
||||
|
||||
{% set result = run_query(get_timestamp) %}
|
||||
{% set current_timestamp = result.columns[0].values()[0] %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{% set current_timestamp = modules.datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") %}
|
||||
{% endif %}
|
||||
|
||||
{{ return(current_timestamp) }}
|
||||
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user