John Liu Blog

Every drop counts

Qt Designer notes

We use Qt Desinger to design QGIS plugin. Development Tools Install Plugin Builder (for creating Plugin project), Plugin Reloader (to refresh changes to the Plugin while developing) to assist with plugin development. Use Qt Designer to help create Plugin interface. When develope QGIS plugin, your source file folder and QGIS folder might be different. Instead of constantly copying files across, we can use Junction to creat symbolic link. Refer to the Readme.

Python cheatsheet

To find the Python installed pathes, under DOS command: where python In the Python interpreter, type following Python commands: import os import sys os.path.dirname(sys.executeable) or under DOS command: py -c "import os, sys; print(os.path.dirname(sys.executable))" To find the Python version, under DOS command: py --version py -V py -VV To create a dedicated environment. # from PowerShell / cmd python -m venv .env To use/activate the dedicated environment created above .\.env\Scripts\activate # PowerShell: .

QGIS get data from API

To retrieve data via API call in QGIS, we can utilise Python code to make the API call. Launch QGIS, open Plugins -> Python Console. In Python Console, click Show Editor icon to open editor. In editor window, make new script or open the Python script and execute the Python script. Following is an example Python script to make API call. ##If keyring is not installed, run the following in QGIS Python console to install keyring.

SQL Server Run Different Version of Python

SQL Server Machine Learning Service comes with a default Phyton runtime. For SQL 2019, it’s Phyton 3.5. You might need to run your Phyton script against a different version of Phyton runtime. To configure another Phyton version runtime to be available to your SQL instance, do the following: Install Phyton 3.10 with options to install for all users Install required packages Grant required permissions to SQL Server LaunchPad service account and ALL APPLICATION PACKAGES using icacls @ECHO OFF ECHO installing python "%~dp0python-3.

SQL Server Python integration

SQL Server Machine Learning Services config files are located under C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXP_2019\MSSQL\Binn pythonlauncher.config rlauncher.config When receive following error If the service worked before but not now, check the LaunchPad service has been restarted following restart of SQL Instance. If restart SQL Instance followed by restart LaunchPad service didn’t help, check LaunchPad service account has FULL CONTROL permission on the working folder configured in the above config file From SQL2019, the working folder in the config file is a shortcut link to C:\Program Files\Microsoft SQL Server\MSSQL15.