<p dir="auto"><strong>Migrated issue, originally created by Thomas Tanner (<a href="https://github.com/ttanner">@ttanner</a>)</strong></p>
<p dir="auto">The example<br>
<a href="http://docs.sqlalchemy.org/en/latest/core/constraints.html#configuring-constraint-naming-conventions" rel="nofollow">http://docs.sqlalchemy.org/en/latest/core/constraints.html#configuring-constraint-naming-conventions</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="convention = {
  &quot;ix&quot;: 'ix_%(column_0_label)s',
  &quot;uq&quot;: &quot;uq_%(table_name)s_%(column_0_name)s&quot;,
  &quot;ck&quot;: &quot;ck_%(table_name)s_%(constraint_name)s&quot;,
  &quot;fk&quot;: &quot;fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s&quot;,
  &quot;pk&quot;: &quot;pk_%(table_name)s&quot;
}
"><pre class="notranslate"><code class="notranslate">convention = {
  "ix": 'ix_%(column_0_label)s',
  "uq": "uq_%(table_name)s_%(column_0_name)s",
  "ck": "ck_%(table_name)s_%(constraint_name)s",
  "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
  "pk": "pk_%(table_name)s"
}

</code></pre></div>
<p dir="auto">should be changed to   "ck": "ck_%(table_name)s_%(column_0_name)s",<br>
Otherwise unnamed constraints (for example, Boolean) raise</p>
<p dir="auto">sqlalchemy.exc.InvalidRequestError: Naming convention including %(constraint_name)s token requires that constraint is explicitly named.</p>
<p dir="auto"><strong>Is your feature request related to a problem? Please describe.</strong></p>
<p dir="auto">Today, I use SQLAlchemy to reflect and inspect Postgres tables. People are starting to move away from <code class="notranslate">SERIAL</code> types to using <code class="notranslate">GENERATED BY DEFAULT AS IDENTITY</code> and <code class="notranslate">GENERATED ALWAYS AS IDENTITY</code>.</p>
<p dir="auto">For example if I:</p>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="CREATE TABLE testidentity (id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, name VARCHAR NOT NULL, optional VARCHAR);"><pre class="notranslate"><span class="pl-k">CREATE</span> <span class="pl-k">TABLE</span> <span class="pl-en">testidentity</span> (id <span class="pl-k">BIGINT</span> <span class="pl-k">PRIMARY KEY</span> GENERATED BY DEFAULT <span class="pl-k">AS</span> IDENTITY, name <span class="pl-k">VARCHAR</span> <span class="pl-k">NOT NULL</span>, optional <span class="pl-k">VARCHAR</span>);</pre></div>
<p dir="auto">When I use <code class="notranslate">sqlalchemy.inspect</code> to eventually <code class="notranslate">get_columns</code> I'm given:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[{'name': 'id',
  'type': BIGINT(),
  'nullable': False,
  'default': None,
  'autoincrement': False,
  'comment': None},
 {'name': 'name',
  'type': VARCHAR(),
  'nullable': False,
  'default': None,
  'autoincrement': False,
  'comment': None},
 {'name': 'optional',
  'type': VARCHAR(),
  'nullable': True,
  'default': None,
  'autoincrement': False,
  'comment': None}]"><pre class="notranslate">[{<span class="pl-s">'name'</span>: <span class="pl-s">'id'</span>,
  <span class="pl-s">'type'</span>: <span class="pl-v">BIGINT</span>(),
  <span class="pl-s">'nullable'</span>: <span class="pl-c1">False</span>,
  <span class="pl-s">'default'</span>: <span class="pl-c1">None</span>,
  <span class="pl-s">'autoincrement'</span>: <span class="pl-c1">False</span>,
  <span class="pl-s">'comment'</span>: <span class="pl-c1">None</span>},
 {<span class="pl-s">'name'</span>: <span class="pl-s">'name'</span>,
  <span class="pl-s">'type'</span>: <span class="pl-v">VARCHAR</span>(),
  <span class="pl-s">'nullable'</span>: <span class="pl-c1">False</span>,
  <span class="pl-s">'default'</span>: <span class="pl-c1">None</span>,
  <span class="pl-s">'autoincrement'</span>: <span class="pl-c1">False</span>,
  <span class="pl-s">'comment'</span>: <span class="pl-c1">None</span>},
 {<span class="pl-s">'name'</span>: <span class="pl-s">'optional'</span>,
  <span class="pl-s">'type'</span>: <span class="pl-v">VARCHAR</span>(),
  <span class="pl-s">'nullable'</span>: <span class="pl-c1">True</span>,
  <span class="pl-s">'default'</span>: <span class="pl-c1">None</span>,
  <span class="pl-s">'autoincrement'</span>: <span class="pl-c1">False</span>,
  <span class="pl-s">'comment'</span>: <span class="pl-c1">None</span>}]</pre></div>
<p dir="auto">But there is a default and it does autoincrement</p>
<p dir="auto"><strong>Describe the solution you'd like</strong></p>
<p dir="auto">Support for describing these generated defaults as having a default and as autoincrementing (although the latter is less important)</p>
<p dir="auto"><strong>Describe alternatives you've considered</strong></p>
<p dir="auto">Trying to inspect the metadata via some other library directly and working around SQLAlchemy</p>
<p dir="auto"><strong>Additional context</strong></p>
<p dir="auto">N/A</p>
<p dir="auto"><strong>Have a nice day!</strong></p>