postgres.comments.set_table_comment
postgres.comments.set_table_comment(
conn=None,
*,
schema,
table_name,
comment,
user=None,
host=None,
dbname=None,
port=None,
)Set (or clear) a PostgreSQL table comment using psycopg.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| conn | psycopg connection | Open PostgreSQL connection to use. If omitted, create a connection using user / host / dbname / port. |
None |
| schema | str | Name of the PostgreSQL schema containing the table. | required |
| table_name | str | Name of the PostgreSQL table whose comment should be updated. | required |
| comment | str or None | Comment text to store. Use None to clear the comment. |
required |
| user | optional | PostgreSQL connection settings used only when conn is omitted. |
None |
| host | optional | PostgreSQL connection settings used only when conn is omitted. |
None |
| dbname | optional | PostgreSQL connection settings used only when conn is omitted. |
None |
| port | optional | PostgreSQL connection settings used only when conn is omitted. |
None |
Returns
| Name | Type | Description |
|---|---|---|
| None | This function updates the table comment in place. |
Examples
>>> set_table_comment(schema="crsp", table_name="dsi", comment="Updated 2025-01-31")
>>> set_table_comment(schema="crsp", table_name="dsi", comment=None)