cancel
Showing results for 
Search instead for 
Did you mean: 
dylanwan
Employee
Employee

Introduction

The incorta_sql() function lets you directly query physical schema data in a PySpark MV without going through the old and cumbersome way.

What you need to know before reading this article

Previously, you could use spark.sql() to query the data from physical schema data by creating temp views. 

Let's review the previously tedious steps: 

Go to Schema -> Explore Data -> SQL generation -> Copy the Reference SQL to Notebook -> Load data and create temp view -> Copy and edit the Reference SQL in spark.sql() function 

suxinji_0-1666368760292.png

Incorta Version

Incorta 2022.10.0 or later

Let's Go

 

df = incorta_sql("""
SELECT
    *
FROM
    SCHEMA_NAME.TABLE_NAME
""")

 

Spoiler
Please note that you can directly use schema table and join among them without registering them as Spark temp views.

Example: 

suxinji_1-1666369238222.png

Related Material

Best Practices Index
Best Practices

Just here to browse knowledge? This might help!

Contributors
Version history
Last update:
‎10-26-2022 09:46 AM
Updated by: