user15592843
user15592843

Reputation: 15

How to write python foundry's code workbook

How to write this sql code in Foundry's python code workbook

SELECT DISTINCT excl_rsn_id FROM exclusion_current_1;

Upvotes: 1

Views: 421

Answers (1)

Adil B
Adil B

Reputation: 16856

Here's how you can write that SQL statement in PySpark, using a dataset named exclusion_current_1 in Code Workbooks:

  1. Create a Code Workbook, and choose to import the exclusion_current_1 dataset.

  2. Click the blue New transform button and select Python Code to create a Python Transform.

  3. In the Python Transform code viewer, enter this code:

    return exclusion_current_1.select("excl_rsn_id").distinct()
    
  4. Click the blue Preview button to preview the resulting dataset.

Here is a screenshot of the final Code Workbook setup:

final code workbook setup

Upvotes: 0

Related Questions