Comments (4)
sure
from sqlalchemy import Column, Integer, String, select
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class MyView(Base):
__tablename__ = "my_view"
__table_args__ = {
"info": {"is_view": True},
}
id = Column(Integer, primary_key=True)
name = Column(String)
print(MyView.__table__.info) # {'is_view': True}
I also wasn't able to find it in their docs. Might be worth opening an issue
from alembic_utils.
Great, thank you.
I had to customize the include_object
function in the cookbook since PGView
doesn't have an info
attribute; my function looks like this and gets the desired result:
def include_object(object, name, type_, reflected, compare_to) -> bool:
"""
Exclude views from Alembic's consideration (but includes alembic_utils' views)
"""
if isinstance(object, ReplaceableEntity):
return True
return not object.info.get("is_view", False)
Thanks again for the help!
from alembic_utils.
Yeah, theres an entry for this in the alembic cookbook describing how to ignore tables
https://alembic.sqlalchemy.org/en/latest/cookbook.html#don-t-emit-create-table-statements-for-views
from alembic_utils.
For the life of me, I can't find how to add this info
object to a declarative table. Do you have any insight @olirice?
from alembic_utils.
Related Issues (20)
- [Question] Using Alembic Utils without SQL Alchemy models HOT 3
- [QUESTION] compatibility with sqlalchemy_utils.functions.create_database HOT 2
- Compatibility with SQLAlchemy 2.0 HOT 4
- How to add a function with an " text[] default array['text', 'text2']"? HOT 2
- PGExtension replace `create` with `create if not exists` HOT 4
- Must be owner of materialized view mat_view_name HOT 2
- Alembic autogenerate broken for 'internal' PG functions HOT 5
- PGGrantTable.from_database requires `grantor = CURRENT_USER` HOT 1
- Can't create trigger on the table from the same migration HOT 8
- Ability to avoid duplicate alembic comparator dispatch with `registered_entities` HOT 10
- Typo in pg_trigger docstring
- Migrate to pyproject.toml
- remove duplicate "instance" ref
- Duplicated ReplaceableEntity on every migration HOT 5
- PGFunction detection of plpgsql doesn't account for language definition wrapped in quotes HOT 1
- gracefully handle when a migrator needs to modify a column that a view depends on HOT 8
- [Question] How to add a unique index to definition for PGMaterializedView HOT 4
- Colon character escaped unnecessarily in view autogeneration HOT 4
- Downgrade does not reflect old definition
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alembic_utils.