Re: pass a parameter into sql raw string and execute django

2020-12-20 Thread Luciano Martins
Could you show your whole project? Em sábado, 19 de dezembro de 2020 às 23:32:26 UTC-3, jul.ale...@gmail.com escreveu: > Hello > > First, create a query.py , just for order. > > [image: image.png] > > and declare a function with the parameters you want to receive. > > Then, in your views.py > [

Re: pass a parameter into sql raw string and execute django

2020-12-19 Thread Julio Cojom
Hello First, create a query.py , just for order. [image: image.png] and declare a function with the parameters you want to receive. Then, in your views.py [image: image.png] you need to import connection from django.db finally , you can iterate over the rows fetched with one for loop. [imag

pass a parameter into sql raw string and execute django

2020-12-19 Thread Ronald Kamulegeya
I want to pass parameter in view and i execute the insert query as shown below. I have searched and failed to get a solution. Any hints. Here is the code. My attempt is shown but not correct. def post_payroll(request,p_id): p_id=2 with connection.cursor() as cursor: query = "in