%pip install semantic-link-labs
import sempy_labs as labs
from sempy_labs import ConnectWarehouse
from sempy_labs import ConnectLakehouse
lakehouse_name = ''
lakehouse_workspace_name = ''
warehouse_name = ''
warehouse_workspace_name = ''
with ConnectWarehouse(warehouse=warehouse_name, workspace=warehouse_workspace_name) as sql:
df = sql.query("SELECT * FROM Product")
display(df)
with ConnectWarehouse(warehouse=warehouse_name, workspace=warehouse_workspace_name) as sql:
dfs = sql.query(["SELECT * FROM Product", "SELECT DISTINCT [Category] FROM Product"])
for df in dfs:
display(df)
labs.get_warehouse_tables(warehouse=warehouse_name, workspace=warehouse_workspace_name)
labs.get_warehouse_columns(warehouse=warehouse_name, workspace=warehouse_workspace_name)
with ConnectWarehouse(warehouse=warehouse_name, workspace=warehouse_workspace_name) as sql:
sql.query("CREATE SCHEMA [Business]")
with ConnectWarehouse(warehouse=warehouse_name, workspace=warehouse_workspace_name) as sql:
sql.query(["CREATE SCHEMA [Business]", "CREATE SCHEMA [Marketing]"])
with ConnectLakehouse(lakehouse=lakehouse_name, workspace=lakehouse_workspace_name) as sql:
df = sql.query("SELECT * FROM Product")
display(df)
with ConnectLakehouse(lakehouse=lakehouse_name, workspace=lakehouse_workspace_name) as sql:
dfs = sql.query(["SELECT * FROM Product", "SELECT DISTINCT [Category] FROM Product"])
for df in dfs:
display(df)