Skip to main content

bauplan.helpers

The Bauplan module does not come with pandas, but it can be used with pandas workflows if pandas is installed.

This module provides a few utility functions that can be used to run SQL queries against a Bauplan instance, and to visualize the results in a Python notebook through a magic cell syntax.


def bauplan_sql

This function is a magic cell that allows users to run SQL queries on Bauplan directly in a Python notebook cell - optionally, the branch can be specified next to the magic command, e.g.:

%%bauplan_sql main

SELECT c1 FROM t2 WHERE f=1

The result of the query will be returned as a pandas DataFrame object, which gets nicely visualized in a Python notebook by default.

This function is not intended to be called directly, but rather used as a magic cell.

If you do not have pandas installed, this raises bauplan.exceptions.MissingPandasError.

Parameters

lineint

cellstr



def magic_cell_import_checker

Decorator replace the proper magic cell import with a dummy function if the magic cell import failed at import time.

Parameters

ftyping.Callable


def pandas_import_checker

Decorator checks if pandas is installed before running the function.

The user may have already pandas installed, so we don't bundle it with our SDK - however, if they don't have it, we should let them know that conversion to pandas object will not work!

Parameters

ftyping.Callable


def register_cell_magic

Decorator replace the proper magic cell import with a dummy function if the magic cell import failed at import time.

Parameters

ftyping.Callable