A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/developer-guide/python-connector/../../sql-reference/sql/comment below:

Website Navigation


COMMENT | Snowflake Documentation

COMMENT

Adds a comment or overwrites an existing comment for an existing object.

Comments can be added to all objects (users, roles, warehouses, databases, tables, and so on). You can also use this command to add comments to individual table columns, but not to constraints on columns.

Syntax
COMMENT [ IF EXISTS ] ON <object_type> <object_name> IS '<string_literal>';

COMMENT [ IF EXISTS ] ON COLUMN <table_name>.<column_name> IS '<string_literal>';

Copy

Parameters
ON object_type object_name

Adds a comment to the object of the specified type (for example, TABLE, SCHEMA, VIEW, and so on) with the specified identifier.

If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

ON COLUMN table_name.column_name

Adds a comment to the specified table column.

If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

IS string_literal

Specifies the comment to add.

Default: NULL

Usage notes Examples

Create a schema with a comment, then overwrite the comment:

CREATE SCHEMA my_schema COMMENT='this is comment1';

SHOW SCHEMAS LIKE 'my_schema';

Copy

+-------------------------------+-----------+------------+------------+---------------+---------+------------------+---------+----------------+------+
| created_on                    | name      | is_default | is_current | database_name | owner   | comment          | options | retention_time | ...  |
|-------------------------------+-----------+------------+------------+---------------+---------+------------------+---------+----------------+------|
| 2025-02-26 12:08:52.363 -0800 | MY_SCHEMA | N          | Y          | MY_DB         | MY_ROLE | this is comment1 |         | 1              |  ... |
+-------------------------------+-----------+------------+------------+---------------+---------+------------------+---------+----------------+------+
COMMENT ON SCHEMA my_schema IS 'now comment2';

SHOW SCHEMAS LIKE 'my_schema';

Copy

+-------------------------------+-----------+------------+------------+---------------+---------+--------------+---------+----------------+-----+
| created_on                    | name      | is_default | is_current | database_name | owner   | comment      | options | retention_time | ... |
|-------------------------------+-----------+------------+------------+---------------+---------+--------------+---------+----------------+-----+
| 2025-02-26 12:08:52.363 -0800 | MY_SCHEMA | N          | Y          | MY_DB         | MY_ROLE | now comment2 |         | 1              | ... |
+-------------------------------+-----------+------------+------------+---------------+---------+--------------+---------+----------------+-----+

Create a table with a comment on a table column, then overwrite the comment:

CREATE OR REPLACE TABLE test_comment_table_column(my_column STRING COMMENT 'this is comment3');

DESC TABLE test_comment_table_column;

Copy

+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+------------------+-------------+----------------+
| name      | type              | kind   | null? | default | primary key | unique key | check | expression | comment          | policy name | privacy domain |
|-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+------------------+-------------+----------------|
| MY_COLUMN | VARCHAR(16777216) | COLUMN | Y     | NULL    | N           | N          | NULL  | NULL       | this is comment3 | NULL        | NULL           |
+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+------------------+-------------+----------------+
COMMENT ON COLUMN test_comment_table_column.my_column IS 'now comment4';

DESC TABLE test_comment_table_column;

Copy

+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+--------------+-------------+----------------+
| name      | type              | kind   | null? | default | primary key | unique key | check | expression | comment      | policy name | privacy domain |
|-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+--------------+-------------+----------------|
| MY_COLUMN | VARCHAR(16777216) | COLUMN | Y     | NULL    | N           | N          | NULL  | NULL       | now comment4 | NULL        | NULL           |
+-----------+-------------------+--------+-------+---------+-------------+------------+-------+------------+--------------+-------------+----------------+

Create a view with a comment, then overwrite the comment:

CREATE OR REPLACE VIEW test_comment_view COMMENT='this is comment5' AS (SELECT * FROM test_comment_table_column);

SHOW VIEWS LIKE 'test_comment_view';

Copy

+-------------------------------+-------------------+----------+---------------+-------------+---------+------------------+-----+
| created_on                    | name              | reserved | database_name | schema_name | owner   | comment          | ... |
|-------------------------------+-------------------+----------+---------------+-------------+---------+------------------+-----+
| 2025-02-26 12:38:35.440 -0800 | TEST_COMMENT_VIEW |          | MY_DB         | MY_SCHEMA   | MY_ROLE | this is comment5 | ... |
+-------------------------------+-------------------+----------+---------------+-------------+---------+------------------+-----+
COMMENT ON VIEW test_comment_view IS 'now comment6';

SHOW VIEWS LIKE 'test_comment_view';

Copy

+-------------------------------+-------------------+----------+---------------+-------------+---------+--------------+-----+
| created_on                    | name              | reserved | database_name | schema_name | owner   | comment      | ... |
|-------------------------------+-------------------+----------+---------------+-------------+---------+--------------+-----+
| 2025-02-26 12:38:35.440 -0800 | TEST_COMMENT_VIEW |          | MY_DB         | MY_SCHEMA   | MY_ROLE | now comment6 | ... |
+-------------------------------+-------------------+----------+---------------+-------------+---------+--------------+-----+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4