fix: loading examples in CI returns http error "too many requests" (#33412)

This commit is contained in:
Maxime Beauchemin
2025-05-13 08:36:12 -07:00
committed by GitHub
parent 21ca26acd7
commit 7f14e434c8
12 changed files with 71 additions and 41 deletions

View File

@@ -16,7 +16,6 @@
# under the License.
import logging
import pandas as pd
import polyline
from sqlalchemy import inspect, String, Text
@@ -25,7 +24,7 @@ from superset.sql_parse import Table
from superset.utils import json
from ..utils.database import get_example_database
from .helpers import get_example_url, get_table_connector_registry
from .helpers import get_table_connector_registry, read_example_data
logger = logging.getLogger(__name__)
@@ -38,8 +37,9 @@ def load_bart_lines(only_metadata: bool = False, force: bool = False) -> None:
table_exists = database.has_table(Table(tbl_name, schema))
if not only_metadata and (not table_exists or force):
url = get_example_url("bart-lines.json.gz")
df = pd.read_json(url, encoding="latin-1", compression="gzip")
df = read_example_data(
"bart-lines.json.gz", encoding="latin-1", compression="gzip"
)
df["path_json"] = df.path.map(json.dumps)
df["polyline"] = df.path.map(polyline.encode)
del df["path"]