You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/11 21:53:01 UTC

[GitHub] [superset] hughhhh opened a new pull request, #19653: feat: Create new `ModelRESTApi` for sip-68 models read-only

hughhhh opened a new pull request, #19653:
URL: https://github.com/apache/superset/pull/19653

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   Building out the initial read API endpoints for SIP-68. Currently these endpoints allow users to filter by schema, database, and full text search on name. With the new owners migration I will additional filter for this field after the merge.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #19653: feat: Create new `ModelRESTApi` for sip-68 models read-only

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #19653:
URL: https://github.com/apache/superset/pull/19653#issuecomment-1095655674

   # [Codecov](https://codecov.io/gh/apache/superset/pull/19653?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19653](https://codecov.io/gh/apache/superset/pull/19653?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (2f4c15a) into [sip68Models](https://codecov.io/gh/apache/superset/commit/955413539b3edd892efd6bc069240efb5f5a29ac?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9554135) will **not change** coverage.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@             Coverage Diff              @@
   ##           sip68Models   #19653   +/-   ##
   ============================================
     Coverage        66.47%   66.47%           
   ============================================
     Files             1681     1681           
     Lines            64467    64467           
     Branches          6607     6607           
   ============================================
     Hits             42856    42856           
     Misses           19917    19917           
     Partials          1694     1694           
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `51.14% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19653?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/datasets/models.py](https://codecov.io/gh/apache/superset/pull/19653/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvbW9kZWxzLnB5) | `100.00% <100.00%> (ø)` | |
   | [superset/initialization/\_\_init\_\_.py](https://codecov.io/gh/apache/superset/pull/19653/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvaW5pdGlhbGl6YXRpb24vX19pbml0X18ucHk=) | `91.66% <100.00%> (ø)` | |
   | [superset/models/helpers.py](https://codecov.io/gh/apache/superset/pull/19653/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `91.11% <100.00%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19653?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19653?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [9554135...2f4c15a](https://codecov.io/gh/apache/superset/pull/19653?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] hughhhh closed pull request #19653: feat: Create new `ModelRESTApi` for sip-68 models read-only

Posted by GitBox <gi...@apache.org>.
hughhhh closed pull request #19653: feat: Create new `ModelRESTApi` for sip-68 models read-only
URL: https://github.com/apache/superset/pull/19653


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] hughhhh commented on a diff in pull request #19653: feat: Create new `ModelRESTApi` for sip-68 models read-only

Posted by GitBox <gi...@apache.org>.
hughhhh commented on code in PR #19653:
URL: https://github.com/apache/superset/pull/19653#discussion_r847765650


##########
superset/datasets/models.py:
##########
@@ -90,3 +92,79 @@ class Dataset(Model, AuditMixinNullable, ExtraJSONMixin, ImportExportMixin):
     # Column is managed externally and should be read-only inside Superset
     is_managed_externally = sa.Column(sa.Boolean, nullable=False, default=False)
     external_url = sa.Column(sa.Text, nullable=True)
+
+    # todo(hugh): Figure how to use this field and populate
+    # default_schema = Column()
+
+    # String representing the permissions for a given dataset
+    # todo(hugh): compute these columns based upon the original SqlaTable models
+    # perm = column_property(name)
+    schema = column_property()
+
+    """
+    Legacy Properties used to main backwards compatibility for
+    the current API schema
+    """
+
+    @property
+    def datasource_type(self) -> Optional[str]:
+        return self.__tablename__
+
+    @property
+    def kind(self) -> Optional[str]:
+        # https://github.com/apache/superset/blob/79a7a5d1b1682f79f1aab1723f76a34dcb9bf030/superset/connectors/base/models.py#L121
+        return "virtual" if self.is_physical else "physical"
+
+    @property
+    def schema(self) -> Optional[str]:
+        return "public"
+
+    @property
+    def sql(self) -> Optional[str]:
+        return self.expression
+
+    @property
+    def table_name(self) -> Optional[str]:
+        return self.name
+
+    @property
+    def explore_url(self) -> Optional[str]:
+        return f"/superset/explore/{self.type}/{self.id}/"
+
+    @property
+    def changed_by_url(self) -> Optional[str]:
+        return "todo"
+
+    @property
+    def default_endpoint(self) -> Optional[str]:
+        return "todo"
+
+    @property
+    def description(self) -> Optional[str]:
+        return "todo"
+
+    @property
+    def database(self) -> Optional[Dict[str, Any]]:

Review Comment:
   remove these since we can access tables



##########
superset/datasets/models.py:
##########
@@ -90,3 +92,79 @@ class Dataset(Model, AuditMixinNullable, ExtraJSONMixin, ImportExportMixin):
     # Column is managed externally and should be read-only inside Superset
     is_managed_externally = sa.Column(sa.Boolean, nullable=False, default=False)
     external_url = sa.Column(sa.Text, nullable=True)
+
+    # todo(hugh): Figure how to use this field and populate
+    # default_schema = Column()
+
+    # String representing the permissions for a given dataset
+    # todo(hugh): compute these columns based upon the original SqlaTable models
+    # perm = column_property(name)
+    schema = column_property()
+
+    """
+    Legacy Properties used to main backwards compatibility for
+    the current API schema
+    """
+
+    @property
+    def datasource_type(self) -> Optional[str]:
+        return self.__tablename__
+
+    @property
+    def kind(self) -> Optional[str]:
+        # https://github.com/apache/superset/blob/79a7a5d1b1682f79f1aab1723f76a34dcb9bf030/superset/connectors/base/models.py#L121
+        return "virtual" if self.is_physical else "physical"
+
+    @property
+    def schema(self) -> Optional[str]:
+        return "public"
+
+    @property
+    def sql(self) -> Optional[str]:
+        return self.expression
+
+    @property
+    def table_name(self) -> Optional[str]:
+        return self.name
+
+    @property
+    def explore_url(self) -> Optional[str]:
+        return f"/superset/explore/{self.type}/{self.id}/"
+
+    @property
+    def changed_by_url(self) -> Optional[str]:
+        return "todo"
+
+    @property
+    def default_endpoint(self) -> Optional[str]:
+        return "todo"
+
+    @property
+    def description(self) -> Optional[str]:
+        return "todo"
+
+    @property
+    def database(self) -> Optional[Dict[str, Any]]:
+        if self.tables:
+            database = (
+                db.session.query(Database)
+                .filter(Database.id == self.tables[0].database_id)
+                .one()
+            )
+            return database.data
+        return None
+
+    @property
+    def schema(self) -> Optional[str]:

Review Comment:
   remove



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org