Client APIs
Side Effects
By default DuckDB will assume the created function is a *pure* function, meaning it will produce the same output when given the same input.
If your function does not follow that rule, for example when your function makes use of randomness, then you will need to mark this function as having `side_effects`.  
For example, this function will produce a new count for every invocation  
```python
def count() -> int:
old = count.counter;
count.counter += 1
return old

count.counter = 0
```  
If we create this function without marking it as having side effects, the result will be the following:  
```python
con = duckdb.connect()
con.create_function("my_counter", count, side_effects = False)
res = con.sql("SELECT my_counter() FROM range(10)").fetchall()
print(res)
```  
```text
[(0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,)]
```  
Which is obviously not the desired result, when we add `side_effects = True`, the result is as we would expect:  
```python
con.remove_function("my_counter")
count.counter = 0
con.create_function("my_counter", count, side_effects = True)
res = con.sql("SELECT my_counter() FROM range(10)").fetchall()
print(res)
```  
```text
[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)]
```