GoogleCloudPlatform / GoogleCloudPlatform/professional-services-data-validator

Potential PostgreSQL result handler improvements

Open
#1,755 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
524
Forks
171
Avg merge
5d 15h
Merged PRs (30d)
4

Description

For consideration.

## 1. Create table error handler

If `self._client.create_table` below throws an exception, there are a couple of cases we can provide a more informative error message.

```
try:
_ = clients.get_ibis_table(self._client, schema_name, table_name)
# Do nothing, the table exists.
except sqlalchemy.exc.NoSuchTableError:
self._client.create_table(table_name, schema=RESULTS_TABLE_SCHEMA)
```

- `psycopg2.errors.InvalidSchemaName` then either the schema does not exist or, more likely, we are missing the USAGE privilege. We can give the user some clues in the error message. `GRANT USAGE ON SCHEMA ...`
- `psycopg2.errors.InsufficientPrivilege` then we are missing the CREATE privilege. `GRANT CREATE ON SCHEMA ...`

## 2. Result table

Should we create some default indexes on the results table?

- `run_id`
- `source_table_name`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.