'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;



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adil B