Troubleshooting a scope mismatch attribute error: Error while executing script 'custom-check-no-tables.py': AttributeError: 'NoneType' object has no attribute 'getObjectTypeName' line: 7

If the scope you specify in the CLI while creating a Custom Policy Check is mismatched with what your Python code actually does, you may receive an error like this:

Error while executing script 'custom-check-no-tables.py': AttributeError: 'NoneType' object has no attribute 'getObjectTypeName' line: 7

The Python code provided in this tutorial calls on database objects. This means you necessarily have to set the scope to database while you create the check. Conversely, if you are creating a check that calls on changelog objects, you necessarily have to set the scope to changelog.