Doing imports in a Python project
When running scripts, PYTHONPATH is set to the parent directory of the executed script. Import statements that include the full path from the project root (absolute imports - e.g. import mypackage...
When running scripts, PYTHONPATH is set to the parent directory of the executed script. Import statements that include the full path from the project root (absolute imports - e.g. import mypackage...
Magic commands are flagged as errors in VSCode by Pylance as they are not Python. Setting "jupyter.interactiveWindow.textEditor.magicCommandsAsComments": true and prefacing commands with # ! means...
A simple query can be constructed as follows: import os from sqlalchemy import MetaData, select, Table import ds_utils.database_operations as dbo # CONNECT TO DATABASE engine = dbo.connect_sql_...
pandas pd.read_sql()/pd.read_sql_query() Parameters are supplied in a different format depending on the database driver being used. pyodbc doesn’t support named parameters - parameters instead hav...
If using st.navigation to manage creation of the navigation, as of version 1.44.0 there is no way of hiding individual pages from the navigation. This can be done by including code such as the fol...
At the time of writing, the version of the ODBC Driver for SQL Server available in Streamlit Community Cloud is version 17. This is pre-installed in Streamlit Community Cloud so it isn’t necessary...
Hyperlinks can be added to columns in AG Grid as in the following script: class UrlCellRenderer { init(params) { this.eGui = document.createElement("a"); this.eGui.innerText = "...
Functions should start with a _single_leading_underscore where they are only intended to be used within a given function/Class. Doing this, from M import * does not import objects whose name starts...
Things held as configuration variables and secrets in GitHub must be defined as environment variables in the GitHub Actions workflow in order to be able to use them in a script. Configuration vari...
Use: - name: Install Microsoft ODBC run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y Ref (NB: additional steps, on port mapping, don’t seem to be necessary. This is an abbreviated versio...