SamplePythonScript.py (1.5 KB)
SierraDB.py (156 Bytes)
SQL.py (181 Bytes)
I am posting this code for a couple of folks on the Sierra listerv. The SierraDB.py file will have to be edited for your Sierra environment, but there are only three parameters to supply. The code assumes the psycopg2 and pprint modules are installed. I am running Python 3.10.
As a simple demonstration, SamplePythonScript.py will print 15 location codes and names. This is intended as a starting point for Sierra users who know Sierra SQL and some Python but don’t necessarily know how to use Python to run a SQL query, load a data structure with the query output and iterate over it. HTH.