Plugins¶
When building the model registry, Gisaf reads module with a specific entry point: gisaf_extras.models
.
Example¶
setup.py
file of a Pyhton module:
from setuptools import setup, find_packages setup( name='gisaf_foo_extras', packages=find_packages(), version='2018.1', entry_points={ 'gisaf_extras.models': [ 'foo = models.foo:FooBar', ] } )
Model defined in models/foo.py
:
from gisaf.database import db from gisaf.models_base import GeoPolygonModel class FooBar(GeoPolygonModel): __tablename__ = 'foobar' __table_args__ = {'schema' : 'other_foobar'} name = db.Column(db.String)