bito-code-review[bot] commented on code in PR #36933: URL: https://github.com/apache/superset/pull/36933#discussion_r2894979952
########## superset/models/embedded_chart.py: ########## @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +import uuid + +from flask_appbuilder import Model +from sqlalchemy import Column, ForeignKey, Integer, Text +from sqlalchemy.orm import relationship +from sqlalchemy_utils import UUIDType + +from superset.models.helpers import AuditMixinNullable + + +class EmbeddedChart(Model, AuditMixinNullable): + """ + A configuration of embedding for a chart. + + References the chart (slice), and contains a config for embedding that chart. + + This data model allows multiple configurations for a given chart, + but at this time the API only allows setting one. + """ + + __tablename__ = "embedded_charts" + + uuid = Column(UUIDType(binary=True), default=uuid.uuid4, primary_key=True) + allow_domain_list = Column(Text) # reference the `allowed_domains` property instead + chart_id = Column( + Integer, + ForeignKey("slices.id", ondelete="CASCADE"), + nullable=False, + ) + chart = relationship( + "Slice", + back_populates="embedded", + foreign_keys=[chart_id], + ) + + @property + def allowed_domains(self) -> list[str]: + """ + A list of domains which are allowed to embed the chart. + An empty list means any domain can embed. + """ + return self.allow_domain_list.split(",") if self.allow_domain_list else [] Review Comment: <!-- Bito Reply --> This question isn’t related to the pull request. I can only help with questions about the PR’s code or comments. ########## superset/embedded_chart/exceptions.py: ########## @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from superset.exceptions import SupersetException + + +class EmbeddedChartPermalinkNotFoundError(SupersetException): + """Raised when an embedded chart permalink is not found or has expired.""" + + message = "The embedded chart permalink could not be found or has expired." Review Comment: <!-- Bito Reply --> This question isn’t related to the pull request. I can only help with questions about the PR’s code or comments. ########## docs/docs/configuration/databases.mdx: ########## @@ -1137,6 +1194,28 @@ More information about PostgreSQL connection options can be found in the and the [PostgreSQL docs](https://www.postgresql.org/docs/9.1/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS). +:::resources +- [Blog: Data Visualization in PostgreSQL With Apache Superset](https://www.tigerdata.com/blog/data-visualization-in-postgresql-with-apache-superset) +::: + +#### QuestDB + +[QuestDB](https://questdb.io/) is a high-performance, open-source time-series database with SQL support. +The recommended connector library is the PostgreSQL driver [psycopg2](https://www.psycopg.org/docs/), +as QuestDB supports the PostgreSQL wire protocol. + +The connection string is formatted as follows: + +``` +postgresql+psycopg2://{username}:{password}@{hostname}:{port}/{database} +``` + +The default port for QuestDB's PostgreSQL interface is `8812`. + +:::resources +- [QuestDB Docs: Apache Superset Integration](https://questdb.com/docs/third-party-tools/superset/) Review Comment: <!-- Bito Reply --> This question isn’t related to the pull request. I can only help with questions about the PR’s code or comments. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
