Open himeshr opened 3 months ago
As discussed with @himeshr Followed 3rd approach
cd /home/superset/superset/lib/python3.8/site-packages/superset/importexport
giving error to convert binary(14) to uuid solution:
-- to get column which is used in uuid
SELECT tbl_name FROM sqlite_master WHERE type='table' AND EXISTS ( SELECT 1 FROM pragma_table_info(tbl_name) WHERE name = 'uuid' );
- created below config file
```conf
LOAD DATABASE
FROM sqlite://superset.db
INTO postgresql://superset_user:superset_password@localhost:5435/superset2
WITH data only, reset sequences, truncate, concurrency = 1, batch rows = 500, prefetch rows = 1000
CAST column sql_metrics.uuid to uuid drop typemod using byte-vector-to-hexstring, column clusters.uuid to uuid drop typemod using byte-vector-to-hexstring, column columns.uuid to uuid drop typemod using byte-vector-to-hexstring, column metrics.uuid to uuid drop typemod using byte-vector-to-hexstring, column dashboard_email_schedules.uuid to uuid drop typemod using byte-vector-to-hexstring, column slice_email_schedules.uuid to uuid drop typemod using byte-vector-to-hexstring, column saved_query.uuid to uuid drop typemod using byte-vector-to-hexstring, column report_execution_log.uuid to uuid drop typemod using byte-vector-to-hexstring, column table_columns.uuid to uuid drop typemod using byte-vector-to-hexstring, column dashboards.uuid to uuid drop typemod using byte-vector-to-hexstring, column datasources.uuid to uuid drop typemod using byte-vector-to-hexstring, column dbs.uuid to uuid drop typemod using byte-vector-to-hexstring, column slices.uuid to uuid drop typemod using byte-vector-to-hexstring, column tables.uuid to uuid drop typemod using byte-vector-to-hexstring, column embedded_dashboards.uuid to uuid drop typemod using byte-vector-to-hexstring, column sl_datasets.uuid to uuid drop typemod using byte-vector-to-hexstring, column sl_tables.uuid to uuid drop typemod using byte-vector-to-hexstring, column sl_columns.uuid to uuid drop typemod using byte-vector-to-hexstring, column key_value.uuid to uuid drop typemod using byte-vector-to-hexstring
SET work_mem TO '128MB', maintenance_work_mem TO '512MB';
----
1. create network for superset and postgres and run postgres
```docker
docker network create superset_network
docker run -d \
-p 5435:5432 \
--name postgres_db \
--network superset_network \
-e POSTGRES_USER=superset_user \
-e POSTGRES_PASSWORD=superset_password \
-e POSTGRES_DB=superset_db \
postgres
create db superset2
create container of superset 2.0.1 and with below command
docker run -d -p 8088:8088 --network superset_network -e "SUPERSET_SECRET_KEY=abc" --name superset_2.0.1 apache/superset:2.0.1
go to container and add path to postgres db and restart the container
docker exec -it -u root superset_2.0.1 bash
echo "SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://superset_user:superset_password@postgres_db:5432/superset2'" > superset_config.py
SUPERSET_CONFIG_PATH=/app/superset_config.py
go to superset container and run below command
superset db upgrade
superset init
6.run command for pgloader and check the error
pgloader pgloaderdataonly.conf > error.txt
move card to qa ready. implementation team will do sanity test. @himeshr @pkundu
Migrate Superset persistence from sqlLite to Postgres DB on Prod RDS.
Options to migrate: