Remove custom sqlalchemy metadata, manage with __table_args__
Allow sqlmodel queries, with relations Remode join_with mechanisms coming from gino Handlew ith_only_columns in get_df and get_gdf Implement feature-info
This commit is contained in:
parent
1e3678fb69
commit
ec71b6ed15
18 changed files with 353 additions and 141 deletions
|
@ -3,11 +3,11 @@ from enum import Enum
|
|||
from sqlmodel import Field, Relationship
|
||||
|
||||
from gisaf.models.models_base import Model
|
||||
from gisaf.models.metadata import gisaf_survey
|
||||
from gisaf.models.metadata import gisaf_survey_table_args
|
||||
|
||||
|
||||
class Accuracy(Model, table=True):
|
||||
metadata = gisaf_survey
|
||||
__table_args__ = gisaf_survey_table_args
|
||||
|
||||
class Admin:
|
||||
menu = 'Other'
|
||||
|
@ -25,7 +25,7 @@ class Accuracy(Model, table=True):
|
|||
|
||||
|
||||
class Surveyor(Model, table=True):
|
||||
metadata = gisaf_survey
|
||||
__table_args__ = gisaf_survey_table_args
|
||||
|
||||
class Admin:
|
||||
menu = 'Other'
|
||||
|
@ -42,7 +42,7 @@ class Surveyor(Model, table=True):
|
|||
|
||||
|
||||
class Equipment(Model, table=True):
|
||||
metadata = gisaf_survey
|
||||
__table_args__ = gisaf_survey_table_args
|
||||
|
||||
class Admin:
|
||||
menu = 'Other'
|
||||
|
@ -62,17 +62,17 @@ class GeometryType(str, Enum):
|
|||
line_work = 'Line_work'
|
||||
|
||||
class AccuracyEquimentSurveyorMapping(Model, table=True):
|
||||
metadata = gisaf_survey
|
||||
__table_args__ = gisaf_survey_table_args
|
||||
__tablename__ = 'accuracy_equiment_surveyor_mapping'
|
||||
|
||||
class Admin:
|
||||
menu = 'Other'
|
||||
|
||||
id: int | None= Field(default=None, primary_key=True)
|
||||
surveyor_id: int = Field(foreign_key='surveyor.id', index=True)
|
||||
equipment_id: int = Field(foreign_key='equipment.id', index=True)
|
||||
surveyor_id: int = Field(foreign_key=gisaf_survey_table_args['schema'] + '.surveyor.id', index=True)
|
||||
equipment_id: int = Field(foreign_key=gisaf_survey_table_args['schema'] + '.equipment.id', index=True)
|
||||
geometry_type: GeometryType = Field(default='Point', index=True)
|
||||
accuracy_id: int = Field(foreign_key='accuracy.id')
|
||||
accuracy_id: int = Field(foreign_key=gisaf_survey_table_args['schema'] + '.accuracy.id')
|
||||
surveyor: Surveyor = Relationship()
|
||||
accuracy: Accuracy = Relationship()
|
||||
equipment: Equipment = Relationship()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue