Go Back
Date formatting with Spark and Jinja
Publisher
: Lingk
Run In Lingk
Description
This recipe demonstrates using Spark and Jinja (Jinjava) expressions. To run this recipe, click the "Run" and "Start Recipe" buttons.
Browse the knowledge base
Twitter
E-Mail
# _____ _ _____ __ # | __ \ (_) |_ _| / _| # | |__) |___ ___ _ _ __ ___ | | _ __ | |_ ___ # | _ // _ \/ __| | '_ \ / _ \ | | | '_ \| _/ _ \ # | | \ \ __/ (__| | |_) | __/ _| |_| | | | || (_) | # |_| \_\___|\___|_| .__/ \___| |_____|_| |_|_| \___/ # | | # |_| # Project Name - DATE FORMATTING WITH SPARK AND JINJA # Recipe URL - https://app.lingk.io/a/10932/tf/17856 # Description - # This recipe demonstrates using Spark and Jinja (Jinjava) expressions. # To run this recipe, click the "Run" and "Start Recipe" buttons. # Industry - Higher Ed # Business Process - Graduate Reporting # Systems - # Connectors - JSON # Data Flows - Single Direction # Connection Type - JSON # Add Recipe notes / Change log information here! # _____ _ # / ____| | | # | | ___ _ __ _ __ ___ ___| |_ ___ _ __ ___ # | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __| # | |___| (_) | | | | | | | __/ (__| || (_) | | \__ \ # \_____\___/|_| |_|_| |_|\___|\___|\__\___/|_| |___/ # # CONNECTORS specify what data will be pulled into the in-memory database during processing connectors: # JSON Setup - https://help.lingk.io/en/articles/74-json-connector-reference ###### Start: JSON Connectors ####### - name: dateExamples type: json parameterizedBy: currentTimestamp # this contains a single row containing a "date" column properties: jsonObject: | # You can use Jinja functions and expressions in connector properties [{ "dateJinja": "{{ func:date_format(func:current_datetime(), 'd-MMMM-y') }}", "dateSpark": "{{var.date}}" } ] ###### End: JSON Connectors ####### # _____ _ _ _ # / ____| | | | | | # | (___ | |_ __ _| |_ ___ _ __ ___ ___ _ __ | |_ ___ # \___ \| __/ _` | __/ _ \ '_ ` _ \ / _ \ '_ \| __/ __| # ____) | || (_| | || __/ | | | | | __/ | | | |_\__ \ # |_____/ \__\__,_|\__\___|_| |_| |_|\___|_| |_|\__|___/ # STATEMENTS specify how the data should be processed while in memory statements: #******************************************************************** D I S C L A I M E R *********************************************************************************************** # * # Note that in an effort to keep recipes optimized for DPH (Data Processing Hours), print statements should be commented out after development has concluded for a recipe. * # For more information on DPH optimization, please visit the following help article - https://help.lingk.io/en/articles/212-minimizing-data-processing-hours-on-the-lingk-platform * # * #******************************************************************** D I S C L A I M E R *********************************************************************************************** ### Format the current timestamp using Spark SQL functions - statement: | (currentTimestamp) => SELECT date_format(current_timestamp() , "d-MMMM-y") as date ### print #- statement: print currentTimestamp ### Refresh the dateExamples connector - statement: refresh dateExamples ### Print the result #- statement: PRINT dateExamples # Add more statements to convert, join, aggregrate, transform, and integrate your data
Trigger Lingk Events through a Recipe
Salesforce EDA to Canvas Course Writer