Extensions
Python
Substrait extension is autoloadable, but if you prefer to do so explicitly, you can use the relevant Python syntax within a connection:  
```python
import duckdb

con = duckdb.connect()
con.install_extension("substrait")
con.load_extension("substrait")
```  
#### BLOB Generation {#docs:extensions:substrait::blob-generation}  
To generate a Substrait BLOB the `get_substrait(sql)` function must be called, from a connection, with a valid SQL select query.  
```python
con.execute(query = "CREATE TABLE crossfit (exercise TEXT, difficulty_level INTEGER)")
con.execute(query = "INSERT INTO crossfit VALUES ('Push Ups', 3), ('Pull Ups', 5), ('Push Jerk', 7), ('Bar Muscle Up', 10)")

proto_bytes = con.get_substrait(query="SELECT count(exercise) AS exercise FROM crossfit WHERE difficulty_level <= 5").fetchone()[0]
```  
#### JSON Generation {#docs:extensions:substrait::json-generation}  
To generate a JSON representing the Substrait plan the `get_substrait_json(sql)` function, from a connection, must be called with a valid SQL select query.  
```python
json = con.get_substrait_json("SELECT count(exercise) AS exercise FROM crossfit WHERE difficulty_level <= 5").fetchone()[0]
```  
#### BLOB Consumption {#docs:extensions:substrait::blob-consumption}  
To consume a Substrait BLOB the `from_substrait(blob)` function must be called, from the connection, with a valid Substrait BLOB plan.  
```python
query_result = con.from_substrait(proto=proto_bytes)
```