I an new to use PyPika. As per their documentation it says I can use Parameter() to pass parameters. Docs
I am not able to find a way to add this into the Query Builder. I am getting errors. ValueError: ':name' is not a valid parameter name
Sample code:
from pypika import functions as fn
from pypika import MSSQLQuery, Table, Field
def sample(name):
sample= Table('sample')
query = MSSQLQuery \
.from_(sample) \
.where(sample.name== Parameter(':name',Parameter.POSITIONAL_ONLY)) \
.groupby(sample.date) \
.select(sample.date, fn.Sum(sample.itemscount))
print(query)
# result = db.execute(query,params=(name))
# data = result.fetchall()
return query
def sample('SAMPLENAME')