Skip to content

Commit

Permalink
feat(country-map): add map for France with all overseas territories (a…
Browse files Browse the repository at this point in the history
…pache#31037)

Co-authored-by: Maxime ALAY-EDDINE <[email protected]>
  • Loading branch information
Tinghecui and Maxime ALAY-EDDINE committed Dec 26, 2024
2 parents e788b85 + 29fd4a3 commit 0ff7c51
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 22 deletions.
5 changes: 3 additions & 2 deletions docker/docker-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ set -eo pipefail

# Make python interactive
if [ "$DEV_MODE" == "true" ]; then
echo "Reinstalling the app in editable mode"
echo "[DEV_MODE detected] Setting the superset package to be in editable mode"
echo "RUN: uv pip install -e ."
uv pip install -e .
fi
REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt"
Expand All @@ -39,7 +40,7 @@ fi
#
if [ -f "${REQUIREMENTS_LOCAL}" ]; then
echo "Installing local overrides at ${REQUIREMENTS_LOCAL}"
uv pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}"
pip install --no-cache-dir -r "${REQUIREMENTS_LOCAL}"
else
echo "Skipping local overrides"
fi
Expand Down
12 changes: 1 addition & 11 deletions docker/docker-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,9 @@ fi

echo_step() {
cat <<EOF
######################################################################
Init Step ${1}/${STEP_CNT} [${2}] -- ${3}
Docker Init Step ${1}/${STEP_CNT} [${2}] -- ${3}
######################################################################
EOF
}
ADMIN_PASSWORD="${ADMIN_PASSWORD:-admin}"
Expand All @@ -52,7 +46,6 @@ fi
# Initialize the database
echo_step "1" "Starting" "Applying DB migrations"
superset db upgrade
echo_step "1" "Complete" "Applying DB migrations"

# Create an admin user
echo_step "2" "Starting" "Setting up admin user ( admin / $ADMIN_PASSWORD )"
Expand All @@ -62,11 +55,9 @@ superset fab create-admin \
--lastname Admin \
--email [email protected] \
--password "$ADMIN_PASSWORD"
echo_step "2" "Complete" "Setting up admin user"
# Create default roles and permissions
echo_step "3" "Starting" "Setting up roles and perms"
superset init
echo_step "3" "Complete" "Setting up roles and perms"

if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
# Load some data to play with
Expand All @@ -78,5 +69,4 @@ if [ "$SUPERSET_LOAD_EXAMPLES" = "yes" ]; then
else
superset load_examples --force
fi
echo_step "4" "Complete" "Loading examples"
fi
1 change: 1 addition & 0 deletions docker/pythonpath_dev/superset_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class CeleryConfig:
# The base URL for the email report hyperlinks.
WEBDRIVER_BASEURL_USER_FRIENDLY = WEBDRIVER_BASEURL
SQLLAB_CTAS_NO_LIMIT = True
LOG_LEVEL = logging.INFO

#
# Optionally import superset_config_docker.py (which will have been included on
Expand Down
4 changes: 2 additions & 2 deletions superset/commands/dataset/importers/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def load_data(data_uri: str, dataset: SqlaTable, database: Database) -> None:

# reuse session when loading data if possible, to make import atomic
if database.sqlalchemy_uri == current_app.config.get("SQLALCHEMY_DATABASE_URI"):
logger.info("Loading data inside the import transaction")
logger.debug("Loading data inside the import transaction")
connection = db.session.connection()
df.to_sql(
dataset.table_name,
Expand All @@ -219,7 +219,7 @@ def load_data(data_uri: str, dataset: SqlaTable, database: Database) -> None:
method="multi",
)
else:
logger.warning("Loading data outside the import transaction")
logger.debug("Loading data outside the import transaction")
with database.get_sqla_engine(
catalog=dataset.catalog,
schema=dataset.schema,
Expand Down
12 changes: 7 additions & 5 deletions superset/examples/birth_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import logging
import textwrap
from typing import Union

Expand All @@ -40,6 +41,8 @@
update_slice_ids,
)

logger = logging.getLogger(__name__)


def gen_filter(
subject: str, comparator: str, operator: str = "=="
Expand Down Expand Up @@ -83,8 +86,7 @@ def load_data(tbl_name: str, database: Database, sample: bool = False) -> None:
method="multi",
index=False,
)
print("Done loading table!")
print("-" * 80)
logging.debug("Done loading table!")


def load_birth_names(
Expand All @@ -104,7 +106,7 @@ def load_birth_names(
table = get_table_connector_registry()
obj = db.session.query(table).filter_by(table_name=tbl_name, schema=schema).first()
if not obj:
print(f"Creating table [{tbl_name}] reference")
logging.debug(f"Creating table [{tbl_name}] reference")
obj = table(table_name=tbl_name, schema=schema)
db.session.add(obj)

Expand Down Expand Up @@ -196,7 +198,7 @@ def create_slices(tbl: SqlaTable) -> tuple[list[Slice], list[Slice]]:
"datasource_type": DatasourceType.TABLE,
}

print("Creating some slices")
logger.debug("Creating some slices")
slices = [
Slice(
**slice_kwargs,
Expand Down Expand Up @@ -561,7 +563,7 @@ def create_slices(tbl: SqlaTable) -> tuple[list[Slice], list[Slice]]:


def create_dashboard(slices: list[Slice]) -> Dashboard:
print("Creating a dashboard")
logger.debug("Creating a dashboard")
dash = db.session.query(Dashboard).filter_by(slug="births").first()
if not dash:
dash = Dashboard()
Expand Down
4 changes: 2 additions & 2 deletions superset/models/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,13 @@ def import_from_dict(
is_new_obj = True
# Create new DB object
obj = cls(**dict_rep)
logger.info("Importing new %s %s", obj.__tablename__, str(obj))
logger.debug("Importing new %s %s", obj.__tablename__, str(obj))
if cls.export_parent and parent:
setattr(obj, cls.export_parent, parent)
db.session.add(obj)
else:
is_new_obj = False
logger.info("Updating %s %s", obj.__tablename__, str(obj))
logger.debug("Updating %s %s", obj.__tablename__, str(obj))
# Update columns
for k, v in dict_rep.items():
setattr(obj, k, v)
Expand Down

0 comments on commit 0ff7c51

Please sign in to comment.