Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update annotation model to have JSON Metadata field #5745

Merged
merged 16 commits into from
Aug 31, 2018

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Aug 27, 2018

Adding an additional field to Annotation Model, to allow users to store additional information about this record.

@mistercrunch @betodealmeida

@hughhhh hughhhh changed the title [WIP] Update annotation model Update annotation model to have JSON Metadata field Aug 27, 2018
@codecov-io
Copy link

codecov-io commented Aug 27, 2018

Codecov Report

Merging #5745 into master will decrease coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5745      +/-   ##
==========================================
- Coverage   63.45%   63.41%   -0.04%     
==========================================
  Files         362      366       +4     
  Lines       22978    25574    +2596     
  Branches     2554     2844     +290     
==========================================
+ Hits        14580    16219    +1639     
- Misses       8383     9340     +957     
  Partials       15       15
Impacted Files Coverage Δ
superset/views/annotations.py 76.08% <100%> (+0.53%) ⬆️
superset/models/annotations.py 93.1% <100%> (+0.24%) ⬆️
superset/assets/src/explore/controls.jsx 41.26% <0%> (-5.01%) ⬇️
superset/assets/src/explore/visTypes.jsx 53.33% <0%> (-3.81%) ⬇️
superset/assets/src/modules/colors.js 77.14% <0%> (-0.41%) ⬇️
...uperset/assets/src/datasource/DatasourceEditor.jsx 72.81% <0%> (-0.12%) ⬇️
...ssets/src/visualizations/deckgl/layers/polygon.jsx 0% <0%> (ø) ⬆️
superset/assets/src/visualizations/country_map.js 0% <0%> (ø) ⬆️
superset/assets/src/visualizations/partition.js 0% <0%> (ø) ⬆️
...ssets/src/visualizations/deckgl/layers/scatter.jsx 0% <0%> (ø) ⬆️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d01c84...8463a01. Read the comment docs.

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For renaming the column in the db it'll come handy to have the downgrade method defined in your migration. First define the downgrade method with the old table name, then run superset db downgrade, then rename the table, ...



def upgrade():
op.add_column('annotation', sa.Column('annotation_metadata', sa.Text(), nullable=True))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migration should have a downgrade too. You can grep and find many other migrations that add_column on upgrade and remove_column on downgarde

@@ -42,6 +42,7 @@ class Annotation(Model, AuditMixinNullable):
layer = relationship(
AnnotationLayer,
backref='annotation')
annotation_metadata = Column(Text)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Knowing that this is the Annotation model, the pattern we've been following is to not repeat the entity name in the column names, as in just id and not annotation_id (since we know all columns in the table has to be annotation-related). There's different school of thought here and different school of data modeling will suggest different column naming schemes, but let's be consistent with other models in Superset.

Also could be nice to have json in the column name to let people know this column contains json text. So maybe something like extra_json or json_metadata.

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For renaming the column in the db it'll come handy to have the downgrade method defined in your migration. First define the downgrade method with the old table name, then run superset db downgrade, then rename the table, ...

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For renaming the column in the db it'll come handy to have the downgrade method defined in your migration. First define the downgrade method with the old table name, then run superset db downgrade, then rename the table, ...

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For renaming the column in the db it'll come handy to have the downgrade method defined in your migration. First define the downgrade method with the old table name, then run superset db downgrade, then rename the table, ...

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For renaming the column in the db it'll come handy to have the downgrade method defined in your migration. First define the downgrade method with the old table name, then run superset db downgrade, then rename the table, ...

@mistercrunch
Copy link
Member

Sorry github was down for a moment and I refreshed the page a few times, review got posted many times

@@ -22,9 +22,12 @@ class AnnotationModelView(SupersetModelView, DeleteMixin): # noqa
add_title = _('Add Annotation')
edit_title = _('Edit Annotation')

list_columns = ['layer', 'short_descr', 'start_dttm', 'end_dttm']
list_columns = ['layer', 'short_descr', 'start_dttm', 'end_dttm',
'annotation_metadata']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think annotation_metadata should be json_metadata, though actually we don't want the json in the list view as it may bloat the table, I think I'd just leave it out.

@mistercrunch
Copy link
Member

LGTM

@hughhhh hughhhh merged commit 5e3f833 into master Aug 31, 2018
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Sep 21, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 11, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Oct 17, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
mistercrunch pushed a commit to lyft/incubator-superset that referenced this pull request Oct 29, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 30, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
youngyjd pushed a commit to lyft/incubator-superset that referenced this pull request Nov 2, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns

(cherry picked from commit 5e3f833)
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* add column to annotation model

* update migration file

* change to Text

* remove old migration file

* add migration file

* remove JSON

* add new column to view

* add comma back

* linting

* lint some more

* missing comma

* rename columns

* add degrade and new migration file

* update version

* fixe changed name

* remove json from list columns
@kristw kristw deleted the update-annotation-model branch March 6, 2019 16:46
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants