Connectors

Contact support

Basics of data apps

Basics of data apps

You can build data apps using Peliqan’s low-code Python scripts. You can write, test and run your scripts inside Peliqan, or you can use your own IDE such as Visual Studio.

In Peliqan, go to “Build” and click on Create app. You can now start writing your Python script. Use the right pane to insert code examples and snippets. Click on “Save & Run” to run your Python script:

image

More info on running scripts:

Running apps (manual, schedule etc.)Running apps (manual, schedule etc.)

Using the pq and st modules

Following two main modules are automatically imported in every Python script in Peliqan:

  • pq module: to access built-in Peliqan functions
  • st module (Streamlit): to show output, visualise data and to add UI elements such as buttons, input fields etc.

Building a UI

Peliqan uses Streamlit as the front-end for your Python scripts, available as the st module (no import needed). Do not use print() in your scripts, instead use st.write(). Example:

st.write("Hello there")

More examples using Streamlit:

st.title("My title")
st.text("My text")
st.line_chart(data)

dbconn = pq.dbconnect(pq.DW_NAME) 
rows = dbconn.fetch('db_name', 'schema_name', 'table_name')

st.table(rows)
st.json(rows)
st.dataframe(rows)

More info:

Interactive appsInteractive apps

Reading data from a table

You can load data from any table into your Python code:

# Open a connection to the Peliqan data warehouse
dbconn = pq.dbconnect(pq.DW_NAME) # See your DW name under My Connections

# Read the rows from the table
rows = dbconn.fetch('db_name', 'schema_name', 'table_name')

More info:

Reading data from tablesReading data from tables

Writing to tables

Here are basic examples of updating data in tables:

# Open a connection to the Peliqan data warehouse
dbconn = pq.dbconnect(pq.DW_NAME)

# Insert a row in a table
dbconn.insert('db_name', 'schema_name', 'table_name', record_dict)

More info:

Writing data to tablesWriting data to tables