<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Automate AI comment generation for columns in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170421#M2142</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/112715"&gt;@25Tabs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding further to above replies, for this use case there aren't any native API calls yet available to generate the comments, but another work around could be:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use IDE's like VS Code with&lt;STRONG&gt; GitHub Copilot for Python&lt;/STRONG&gt; Extension enabled.&amp;nbsp;Copilot uses column names, types, nearby code, and similar repository models to suggest comments.&lt;/LI&gt;&lt;LI&gt;Enable VS Code inline suggestions (Check if this is been enabled in vscode):&amp;nbsp;"editor.inlineSuggest.enabled": true​&lt;/LI&gt;&lt;LI&gt;Maintain metadata of the table (Name, Columns, data types, comments etc as kind of data model), basically it's like source of truth of all table related metadata version controlled. It could be in python or yaml files.&lt;/LI&gt;&lt;LI&gt;Then the copilot extension auto suggests table comments when new table is created/editing existing table model file like this, can accept/modify the text slightly from the suggested comments (like below).&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table_comments_auto_generated.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/31661iBB66BE1026ED1ACE/image-size/large?v=v2&amp;amp;px=999" role="button" title="table_comments_auto_generated.png" alt="table_comments_auto_generated.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;Commit these changes and when CD is done to any workspace, either can have a mechanism within the code itself to update Table Meta data which reads this data model file and update's table comments/ Ad-hoc one time script to run ALTER table table_name ALTER COLUMN column_name COMMENT with comments from above data model file.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This gives version controlled Column comments and ability to tweak them when required and Govern those aswell.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Another approach on the fly update directly as one of activity:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Identify the tables missing columns from information_schema.columns where comment is NULL.&lt;/LI&gt;&lt;LI&gt;Use ai_query to generate the comments as&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;SELECT
    table_catalog,
    table_schema,
    table_name,
    column_name,
    data_type,
    ai_query(
      'system.ai.meta-llama-3-3-70b-instruct',
      CONCAT(
        'Generate a concise Unity Catalog column description. ',
        'Return only the description, no quotes or additional explanation. ',
        'Do not invent business meaning that cannot reasonably be inferred. ',
        'If the meaning is ambiguous, say what the column contains without ',
        'assuming additional business semantics. ',
        'Table: ', table_name,
        'Column: ', column_name,
        'Data type: ', data_type
      ),
      modelParameters =&amp;gt; named_struct(
        'temperature', 0.0,
        'max_tokens', 80
      )
    ) AS proposed_comment
FROM columns_to_document​&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;Then an update script with results from above query to dynamically apply missing comments for all the tables with ALTER COLUMN Comment mechanism.&lt;/LI&gt;&lt;LI&gt;If needed, can go a step further to validate the ai_query generated column comments with &lt;STRONG&gt;ai_decide&amp;nbsp;&lt;/STRONG&gt;(currently in beta version) as quality gate to identify only high confidence score related comments to dynamically update.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Oct 2026 13:16:22 GMT</pubDate>
    <dc:creator>data_pulse</dc:creator>
    <dc:date>2026-10-02T13:16:22Z</dc:date>
    <item>
      <title>Automate AI comment generation for columns</title>
      <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/79216#M274</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question regarding the new AI Comment generation feature. Is it possbile to use this feature without using the UI. Currently i have to accept every suggested comment one-by-one. Is there a feature / SQL or Phython Statement that i can use to auto update multiple tables and their collumns with the AI generated comments feature?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jul 2024 11:16:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/79216#M274</guid>
      <dc:creator>25Tabs</dc:creator>
      <dc:date>2024-07-18T11:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: Automate AI comment generation for columns</title>
      <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/169434#M2088</link>
      <description>&lt;P&gt;Short answer: no, there's no REST API or SQL statement that bulk-accepts the AI-generated comment suggestions you see in Catalog Explorer - that Accept/checkmark flow is UI-only, there's no endpoint behind it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workaround people actually use is to skip the "suggest then accept" UI feature entirely and generate + apply the comments yourself with ai_query(), which is a regular SQL function so it's fully scriptable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Loop over information_schema.columns for the tables/schemas you care about.&lt;/P&gt;&lt;P&gt;2. For each column, call ai_query() against a serving endpoint (a pay-per-token FM like databricks-meta-llama-3-3-70b-instruct works fine for this) with a prompt that includes the table name, column name, data type, and maybe a few sample values.&lt;/P&gt;&lt;P&gt;3. Apply the result with ALTER TABLE catalog.schema.table ALTER COLUMN col COMMENT '&amp;lt;generated text&amp;gt;' (or COMMENT ON COLUMN ... IS '...').&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That whole loop can be a single notebook/Python script driven off the catalog metadata, so you comment hundreds of columns without touching the UI. A couple of things worth building in:&lt;/P&gt;&lt;P&gt;- Batch it per-table and commit as you go, so a bad generation on one column doesn't block the rest.&lt;/P&gt;&lt;P&gt;- Sanity-check the AI output before applying (strip quotes/newlines, length-cap it) since ALTER COLUMN COMMENT will happily accept garbage.&lt;/P&gt;&lt;P&gt;- If you want a human-in-the-loop step without the UI, write the generated comments to a staging table first and review/approve there before the ALTER pass.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a known gap, not something you're missing - the Catalog Explorer feature and the ai_query()-based approach are two separate things &lt;EM&gt;under&lt;/EM&gt; the hood.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2026 13:12:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/169434#M2088</guid>
      <dc:creator>DoTA</dc:creator>
      <dc:date>2026-09-22T13:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Automate AI comment generation for columns</title>
      <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/169576#M2089</link>
      <description>&lt;P&gt;Great question! It would be really useful to have an API or SQL/Python way to generate and apply AI comments in bulk instead of accepting them one by one. Hopefully Databricks can support this workflow. &lt;span class="lia-unicode-emoji" title=":rocket:"&gt;🚀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2026 12:56:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/169576#M2089</guid>
      <dc:creator>ThiamLee</dc:creator>
      <dc:date>2026-09-23T12:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Automate AI comment generation for columns</title>
      <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170391#M2139</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;You could check if there’s an API or Python/SQL-based way to automate this in bulk. Would be great to avoid manually accepting each comment one by one!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;ChatGPT&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;Option 2&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;You could check if the platform provides an API or Python/SQL integration for bulk comment generation. Automating it would save a lot of time compared to approving each comment manually.&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 02 Oct 2026 08:12:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170391#M2139</guid>
      <dc:creator>ThiamLee</dc:creator>
      <dc:date>2026-10-02T08:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Automate AI comment generation for columns</title>
      <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170421#M2142</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/112715"&gt;@25Tabs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adding further to above replies, for this use case there aren't any native API calls yet available to generate the comments, but another work around could be:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use IDE's like VS Code with&lt;STRONG&gt; GitHub Copilot for Python&lt;/STRONG&gt; Extension enabled.&amp;nbsp;Copilot uses column names, types, nearby code, and similar repository models to suggest comments.&lt;/LI&gt;&lt;LI&gt;Enable VS Code inline suggestions (Check if this is been enabled in vscode):&amp;nbsp;"editor.inlineSuggest.enabled": true​&lt;/LI&gt;&lt;LI&gt;Maintain metadata of the table (Name, Columns, data types, comments etc as kind of data model), basically it's like source of truth of all table related metadata version controlled. It could be in python or yaml files.&lt;/LI&gt;&lt;LI&gt;Then the copilot extension auto suggests table comments when new table is created/editing existing table model file like this, can accept/modify the text slightly from the suggested comments (like below).&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table_comments_auto_generated.png" style="width: 999px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/31661iBB66BE1026ED1ACE/image-size/large?v=v2&amp;amp;px=999" role="button" title="table_comments_auto_generated.png" alt="table_comments_auto_generated.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;LI&gt;Commit these changes and when CD is done to any workspace, either can have a mechanism within the code itself to update Table Meta data which reads this data model file and update's table comments/ Ad-hoc one time script to run ALTER table table_name ALTER COLUMN column_name COMMENT with comments from above data model file.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This gives version controlled Column comments and ability to tweak them when required and Govern those aswell.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Another approach on the fly update directly as one of activity:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Identify the tables missing columns from information_schema.columns where comment is NULL.&lt;/LI&gt;&lt;LI&gt;Use ai_query to generate the comments as&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;SELECT
    table_catalog,
    table_schema,
    table_name,
    column_name,
    data_type,
    ai_query(
      'system.ai.meta-llama-3-3-70b-instruct',
      CONCAT(
        'Generate a concise Unity Catalog column description. ',
        'Return only the description, no quotes or additional explanation. ',
        'Do not invent business meaning that cannot reasonably be inferred. ',
        'If the meaning is ambiguous, say what the column contains without ',
        'assuming additional business semantics. ',
        'Table: ', table_name,
        'Column: ', column_name,
        'Data type: ', data_type
      ),
      modelParameters =&amp;gt; named_struct(
        'temperature', 0.0,
        'max_tokens', 80
      )
    ) AS proposed_comment
FROM columns_to_document​&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;Then an update script with results from above query to dynamically apply missing comments for all the tables with ALTER COLUMN Comment mechanism.&lt;/LI&gt;&lt;LI&gt;If needed, can go a step further to validate the ai_query generated column comments with &lt;STRONG&gt;ai_decide&amp;nbsp;&lt;/STRONG&gt;(currently in beta version) as quality gate to identify only high confidence score related comments to dynamically update.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2026 13:16:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170421#M2142</guid>
      <dc:creator>data_pulse</dc:creator>
      <dc:date>2026-10-02T13:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: Automate AI comment generation for columns</title>
      <link>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170432#M2143</link>
      <description>&lt;P&gt;The ai_query route is the way to go, nothing to add there. Just a few things&lt;BR /&gt;that will bite you once you point it at a whole catalog.&lt;/P&gt;&lt;P&gt;The big one is in the docs for the AI comments feature itself: saving a comment&lt;BR /&gt;fires an ALTER, and that can disrupt running pipelines and jobs. Everything&lt;BR /&gt;suggested in this thread ends in an ALTER too, so if you are doing a few&lt;BR /&gt;hundred columns you are firing a few hundred ALTERs. Do the apply pass in a&lt;BR /&gt;maintenance window, or at least leave your busy tables for last. Generating the&lt;BR /&gt;comments is harmless, it is the applying that needs care.&lt;/P&gt;&lt;P&gt;Permissions are not the same everywhere either. Tables and columns need MODIFY,&lt;BR /&gt;but views and materialized views need ownership. So a loop over&lt;BR /&gt;information_schema will run fine until it hits the first view you do not own&lt;BR /&gt;and then die. Catch failures per object and log them instead of letting one&lt;BR /&gt;kill the whole run.&lt;/P&gt;&lt;P&gt;And escape the text before you build the statement. The model will eventually&lt;BR /&gt;return something like "the customer's id" and your ALTER breaks on the quote.&lt;BR /&gt;Double the single quotes, cap the length, done.&lt;/P&gt;&lt;P&gt;Last thing, more about quality than mechanics: doing one column at a time gives&lt;BR /&gt;you pretty generic comments. If you send the whole column list of a table in&lt;BR /&gt;one prompt and ask for all the descriptions together, the model actually sees&lt;BR /&gt;what the table is, and the output is a lot less boilerplate. Fewer calls as&lt;BR /&gt;well.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Oct 2026 15:39:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/automate-ai-comment-generation-for-columns/m-p/170432#M2143</guid>
      <dc:creator>juanlozadab</dc:creator>
      <dc:date>2026-10-02T15:39:36Z</dc:date>
    </item>
  </channel>
</rss>

