system.db.execQuery does not work but system.db.runNamedQuery does

I have a gateway tag change script that works. However, when I attempted to change from the system.db.runNamedQuery function to the system.db.execQuery function, it fails with the following error:

Jython Exception occurred: Traceback (most recent call last):
File "TagChangeScript:pcsMaster/ImportFiles", line 22, in onTagChange
TypeError: str indices must be integers

Here is the script with the new functions commented out.

def onTagChange(initialChange, newValue, previousValue, event, executionCount):
    # Import Files Script
    # Import the Java Exception class
    import java.lang.Exception
    from java.lang import Throwable
    # Import traceback module
    import traceback
    # Do nothing if tag is initializing/ or gateway is starting. We may change this later.
    if initialChange:
        return
    # Only continue if data quality is good.
    if not newValue.quality:
        return
    if previousValue.value == 0 and newValue.value == 1:
        try:
            logger = system.util.getLogger("Import Files Script")
            # This is where all named queries that need to be ran will be called from.
            # Tag scripts run in Gateway scope, so the project name is required
            # CircNewTankTbl
            projectName = "pcsMaster"
            queryPath = "Cfg/qCircNewTankTbl"
            # myTankTbl = system.db.execQuery(queryPath, projectName)
            myTankTbl = system.db.runNamedQuery(projectName, queryPath)
            tagPath = "[default]Circ/CircNewTankTbl"
            system.tag.writeBlocking(tagPath, myTankTbl)
            # ManualDeviceTbl
            projectName = "pcsMaster"
            queryPath = "Cfg/qManualDeviceTbl"
            # myManualDeviceTbl = system.db.execQuery(queryPath, projectName)
            myManualDeviceTbl = system.db.runNamedQuery(projectName, queryPath)
            tagPath = "[~]Sys/ManualDeviceTbl"
            system.tag.writeBlocking(tagPath, myManualDeviceTbl)
            # Reset ImportFiles tag after all named queries have been ran.
            logger.info("Import files queries completed successfully.")
        except Exception, err:
            # push the error text to the logger
            logger.error("Jython Exception occurred: %s" % traceback.format_exc())
        except Throwable, j_err:
            # push the error text to the logger
            logger.error("Java Exception occurred: %s" % j_err.getMessage())
        else:
            # logger.info("No error.")
            pass
        finally:
            # logger.info("This always completes.")
            # Reset ImportFiles tag to FALSE
            system.tag.writeBlocking("[default]Sys/ImportFiles", 0)
            # Logs can be viewed in the gateway http://localhost:8088/app/diagnostics/logs    

Any help would be appreciated. I am new to Ignition, Jython, Python, so please be gentle.

system.db.execQuery doesn't have a projectName argument.

It's trying to interpret the projectName string as a parameters dictionary.
Try using system.db.execQuery(queryPath,parameters={},project=projectName)

system.db.execQuery | Ignition User Manual

That works. Thank you so much for your help!

If you're using an LLM for assistance (I'm pretty confident you are), consider...not. The script you've got is full of antipatterns and inefficiencies that are making it actively harder to maintain, and if you're new to this, learning bad habits is a bad place to start.