sqlalchemy / sqlalchemy/alembic

models that refer to a view with Table, the Table comes up in autogenerate. how to make this easier?

Open
#349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autogenerate - detection bug Tier 1
Dominant language
Python
Stars
4.4k
Forks
375
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by Michael Bayer (@zzzeek)

this is probably what was seen in #273 but wasn't well-described. if an application uses Table on the model side to refer to a view in the database, we don't consult inspector.get_view_names() in order to exclude these. An include_object rule can of course fix this, however we at least should document this workaround, and perhaps add a configure flag "exclude_views=True" that does this automatically.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review Alembic autogeneration's handling of model-side Table objects, especially inspector.get_view_names() and the include_object workaround described here. First determine whether the contribution should document the workaround or introduce an exclude_views configuration option; done means the chosen behavior is documented or consistently excludes database views, with coverage for the affected autogenerate case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
databases, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.