Admin: add relations
This commit is contained in:
parent
75bedb3e91
commit
76a4e8f023
1 changed files with 6 additions and 2 deletions
|
@ -9,6 +9,7 @@ import pandas as pd
|
||||||
from gisaf.models.models_base import Model
|
from gisaf.models.models_base import Model
|
||||||
from gisaf.models.survey import Surveyor, Equipment
|
from gisaf.models.survey import Surveyor, Equipment
|
||||||
from gisaf.models.project import Project
|
from gisaf.models.project import Project
|
||||||
|
from gisaf.models.metadata import gisaf_admin
|
||||||
|
|
||||||
|
|
||||||
re_file_import_record_date_expr = '^(\S+)-(\d\d\d\d)-(\d\d)-(\d\d).*$'
|
re_file_import_record_date_expr = '^(\S+)-(\d\d\d\d)-(\d\d)-(\d\d).*$'
|
||||||
|
@ -44,7 +45,7 @@ class FileImport(Model):
|
||||||
Give either url or path.
|
Give either url or path.
|
||||||
"""
|
"""
|
||||||
__tablename__ = 'file_import'
|
__tablename__ = 'file_import'
|
||||||
__table_args__ = {'schema' : 'gisaf_admin'}
|
metadata = gisaf_admin
|
||||||
|
|
||||||
id: int | None = Field(default=None, primary_key=True)
|
id: int | None = Field(default=None, primary_key=True)
|
||||||
url: str
|
url: str
|
||||||
|
@ -59,10 +60,13 @@ class FileImport(Model):
|
||||||
store: str
|
store: str
|
||||||
basket: str
|
basket: str
|
||||||
project_id: int = Field(foreign_key='project.id')
|
project_id: int = Field(foreign_key='project.id')
|
||||||
|
project: Project = Relationship()
|
||||||
# ALTER TABLE gisaf_admin.file_import add column project_id INT REFERENCES gisaf_admin.project;
|
# ALTER TABLE gisaf_admin.file_import add column project_id INT REFERENCES gisaf_admin.project;
|
||||||
surveyor_id: int = Field(foreign_key='surveyor.id')
|
surveyor_id: int = Field(foreign_key='surveyor.id')
|
||||||
|
surveyor: Surveyor = Relationship()
|
||||||
# ALTER TABLE gisaf_admin.file_import add column surveyor_id INT REFERENCES gisaf_survey.surveyor;
|
# ALTER TABLE gisaf_admin.file_import add column surveyor_id INT REFERENCES gisaf_survey.surveyor;
|
||||||
equipment_id: int = Field(foreign_key='equipment.id')
|
equipment_id: int = Field(foreign_key='equipment.id')
|
||||||
|
equipment: Equipment = Relationship()
|
||||||
# ALTER TABLE gisaf_admin.file_import add column equipment_id INT REFERENCES gisaf_survey.equipment;
|
# ALTER TABLE gisaf_admin.file_import add column equipment_id INT REFERENCES gisaf_survey.equipment;
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -117,7 +121,7 @@ class FeatureImportData(Model):
|
||||||
Keep track of imported data, typically from shapefiles
|
Keep track of imported data, typically from shapefiles
|
||||||
"""
|
"""
|
||||||
__tablename__ = 'feature_import_data'
|
__tablename__ = 'feature_import_data'
|
||||||
__table_args__ = {'schema' : 'gisaf_admin'}
|
metadata = gisaf_admin
|
||||||
|
|
||||||
id: int | None = Field(default=None, primary_key=True)
|
id: int | None = Field(default=None, primary_key=True)
|
||||||
store: str = Field(index=True)
|
store: str = Field(index=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue