Naming conflicts
Collection naming collisions
from flask_sqlalchemy import SQLAlchemy
from forestadmin.datasource_sqlalchemy.datasource import SqlAlchemyDatasource
from .utils import to_pascal_case
db = SQLAlchemy()
with app.app_context():
db.init_app(app)
agent.add_datasource(SqlAlchemyDatasource(db), {
"rename": {
"Customer": "CustomerFromSQLAlchemy",
"Store": "StoreFromSQLAlchemy",
}
})
# Renaming collection can also be done by providing a function.
# All collections will be renamed (the handler is called once per collection)
agent.add_datasource(SqlAlchemyDatasource(db), {
"rename": lambda name: to_pascal_case(name)
})
Field naming collisions
Last updated