Skip to content

Commit 18adfe8

Browse files
authored
feat: Add schema programmatic description relationship in schema model (#10)
* put RDSModel into __all__ Signed-off-by: xuans <xuan_shen@outlook.com> * Add schema_programmatic_descriptions relationship Signed-off-by: xuans <xuan_shen@outlook.com> * Fix attr name typo in updated_timestamp Signed-off-by: xuans <xuan_shen@outlook.com>
1 parent 86437a7 commit 18adfe8

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

amundsen_rds/models/__init__.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,19 @@
2727
from amundsen_rds.models.updated_timestamp import UpdatedTimestamp
2828
from amundsen_rds.models.user import User
2929

30-
__all__ = [
31-
'Application', 'ApplicationTable', 'Badge', 'Cluster',
32-
'TableColumn', 'ColumnBadge', 'ColumnDescription', 'ColumnStat',
33-
'Dashboard', 'DashboardBadge', 'DashboardChart', 'DashboardCluster',
34-
'DashboardDescription', 'DashboardExecution', 'DashboardFollower', 'DashboardGroup',
35-
'DashboardGroupDescription', 'DashboardOwner', 'DashboardQuery', 'DashboardTable',
36-
'DashboardTag', 'DashboardTimestamp', 'DashboardUsage', 'Database',
37-
'Schema', 'SchemaDescription', 'SchemaProgrammaticDescription', 'Table',
38-
'TableBadge', 'TableDescription', 'TableFollower', 'TableOwner',
39-
'TableProgrammaticDescription', 'TableSource', 'TableTag', 'TableTimestamp',
40-
'TableUsage', 'TableWatermark', 'Tag', 'UpdatedTimestamp',
41-
'User'
42-
]
30+
RDSModel = Union[Application, ApplicationTable, Badge, Cluster,
31+
TableColumn, ColumnBadge, ColumnDescription, ColumnStat,
32+
Dashboard, DashboardBadge, DashboardChart, DashboardCluster,
33+
DashboardDescription, DashboardExecution, DashboardFollower, DashboardGroup,
34+
DashboardGroupDescription, DashboardOwner, DashboardQuery, DashboardTable,
35+
DashboardTag, DashboardTimestamp, DashboardUsage, Database,
36+
Schema, SchemaDescription, SchemaProgrammaticDescription, Table,
37+
TableBadge, TableDescription, TableFollower, TableOwner,
38+
TableProgrammaticDescription, TableSource, TableTag, TableTimestamp,
39+
TableUsage, TableWatermark, Tag, UpdatedTimestamp,
40+
User]
4341

44-
RDSModel = Union[
42+
__all__ = [
4543
'Application', 'ApplicationTable', 'Badge', 'Cluster',
4644
'TableColumn', 'ColumnBadge', 'ColumnDescription', 'ColumnStat',
4745
'Dashboard', 'DashboardBadge', 'DashboardChart', 'DashboardCluster',
@@ -52,5 +50,5 @@
5250
'TableBadge', 'TableDescription', 'TableFollower', 'TableOwner',
5351
'TableProgrammaticDescription', 'TableSource', 'TableTag', 'TableTimestamp',
5452
'TableUsage', 'TableWatermark', 'Tag', 'UpdatedTimestamp',
55-
'User'
53+
'User', 'RDSModel'
5654
]

amundsen_rds/models/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class Schema(Base):
2525

2626
cluster = relationship('Cluster')
2727
description = relationship('SchemaDescription', uselist=False)
28+
programmatic_descriptions = relationship('SchemaProgrammaticDescription',
29+
order_by='SchemaProgrammaticDescription.rk')
2830

2931

3032
class SchemaDescription(Base):

amundsen_rds/models/updated_timestamp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ class UpdatedTimestamp(Base):
1313
__tablename__ = 'updated_timestamp'
1414

1515
rk = Column(String(64), primary_key=True)
16-
last_timestamp = Column(Integer, nullable=False)
16+
latest_timestamp = Column(Integer, nullable=False)
1717
published_tag = Column(String(PUBLISHED_TAG_LEN), nullable=False)
1818
publisher_last_updated_epoch_ms = Column(BigInteger, nullable=False)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from setuptools import find_packages, setup
55

6-
__version__ = '0.0.2'
6+
__version__ = '0.0.3'
77

88

99
requirements = [

0 commit comments

Comments
 (0)