Page 1 of 1

[Python] Get SQL Select result in a variable

Posted: Mon May 17, 2021 1:39 pm
by El Catala
Hello,
How do you place in a variable, the result of a Select query contained in a Python script?
In traditional python, fetchall () does the birch well but in libre office, its not working!

Code: Select all

rqt = "SELECT * FROM Table1"
rslt = statement.excute(rqt)
In this case, a message box returns true
Each row in the table should normally be represented by a tuple in result.
So the problem I want to solve is to work on these tuples.
cordially

Re: [Python]-Get SQL Select result in a variable

Posted: Mon May 17, 2021 3:36 pm
by Villeroy
Lean how to use MRI or XRay. Inspect the statement. There is more than execute(sql).

Re: [Python]-Get SQL Select result in a variable

Posted: Tue May 18, 2021 1:48 pm
by El Catala
Hello,

Thank you for your reply. It does not allow me to solve the problem. I wonder more and more whether it would not be better to give up Libre Office altogether.
As much as I was seduced by the python language which allows easy development, its integration into this office suite is catastrophic.
These words only represent my feelings and ask only to be contradicted. It's a shame because Libre Office could be a credible alternative to MS Office.
We must admit to the discharge of developers that the means are light years away from Microsoft !!!

Have a lovely day everybody

Re: [Python]-Get SQL Select result in a variable

Posted: Tue May 18, 2021 2:12 pm
by Villeroy

Code: Select all

$ du -sh /opt/libreoffice7.1
678M	/opt/libreoffice7.1
678 MB including all the components, database drivers, a Basic runtime, a Python runtime. I would think that the footprint of VBA for MS Office Pro is on the same scale of magnitude. VBA is a very thick layer of software, like a second office suite with a CLI instead of the GUI.