Forum Discussion
Amir851
7 years agoHelper I
Pass Python Variable as a query parameter in Advance Editor
Hi All, I am trying to create a query parameter for a variable named as start present in my Python script into Advance Editor in Power BI Desktop. Basically, my script is trying to extract data ...
- 7 years ago
My mistake, we lost the quitation marks. Try:
Source = Python.Execute( "import requests.. other code.... """ & MyVariable & """ .. other code.... "),
If this works I'll update the original answer.
Amir851
7 years agoHelper I
Dear SteveCampbell ,
First of all, Thank you for your reply.
I followed the same procedure as you mentioned.
But encountering below error :
DataSource.Error: ADO.NET: Python script error.
File "PythonScriptWrapper.PY", line 91
start=2019/05/17 06:29
^
SyntaxError: invalid token
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
Screenshot for your reference :
SteveCampbell
7 years agoMemorable Member
This is a python error, in that you should not have leading 0s in your date.
2019/05/17 06:29
Maybe you should use the datetime library:
datetime.datetime(2019, 5, 17, 6, 29)