From 46362fe6d6579942675c68df29608aaaa6210467 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 7 Jan 2025 23:05:27 -0800 Subject: [PATCH] fixing some pandas stuff --- superset/examples/sf_population_polygons.py | 10 +++++----- superset/examples/world_bank.py | 5 ++--- .../integration_tests/fixtures/world_bank_dashboard.py | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/superset/examples/sf_population_polygons.py b/superset/examples/sf_population_polygons.py index b8d5527ed247b..3da20a1705699 100644 --- a/superset/examples/sf_population_polygons.py +++ b/superset/examples/sf_population_polygons.py @@ -16,7 +16,7 @@ # under the License. import pandas as pd -from sqlalchemy import BigInteger, Float, inspect, Text +from sqlalchemy import inspect import superset.utils.database as database_utils from superset import db @@ -47,10 +47,10 @@ def load_sf_population_polygons( if_exists="replace", chunksize=500, dtype={ - "zipcode": BigInteger, - "population": BigInteger, - "contour": Text, - "area": Float, + "zipcode": int, + "population": int, + "contour": str, + "area": float, }, index=False, ) diff --git a/superset/examples/world_bank.py b/superset/examples/world_bank.py index a9c06dfa2942a..a17cf29c7ada5 100644 --- a/superset/examples/world_bank.py +++ b/superset/examples/world_bank.py @@ -17,7 +17,7 @@ import os import pandas as pd -from sqlalchemy import DateTime, inspect, String +from sqlalchemy import inspect, String from sqlalchemy.sql import column import superset.utils.database @@ -69,8 +69,7 @@ def load_world_bank_health_n_pop( # pylint: disable=too-many-locals if_exists="replace", chunksize=50, dtype={ - # TODO(bkyryliuk): use TIMESTAMP type for presto - "year": DateTime if database.backend != "presto" else String(255), + "year": String(255), "country_code": String(3), "country_name": String(255), "region": String(255), diff --git a/tests/integration_tests/fixtures/world_bank_dashboard.py b/tests/integration_tests/fixtures/world_bank_dashboard.py index 983c0fba27b4d..b4a266c6ef3f8 100644 --- a/tests/integration_tests/fixtures/world_bank_dashboard.py +++ b/tests/integration_tests/fixtures/world_bank_dashboard.py @@ -22,7 +22,7 @@ import pandas as pd import pytest from pandas import DataFrame -from sqlalchemy import DateTime, String +from sqlalchemy import String from superset import db from superset.connectors.sqla.models import SqlaTable @@ -47,7 +47,7 @@ def load_world_bank_data(): with app.app_context(): database = get_example_database() dtype = { - "year": DateTime if database.backend != "presto" else String(255), + "year": String(255), "country_code": String(3), "country_name": String(255), "region": String(255),