Skip to content

Commit

Permalink
#19 | #34 | #36 | steps to remove schema which superset removed support
Browse files Browse the repository at this point in the history
  • Loading branch information
vedfordev committed Aug 21, 2024
1 parent a0d816c commit ca76b04
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
33 changes: 33 additions & 0 deletions reportingSystem/superset/assets/remove_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- to get information about where schema used
select * from information_schema.tables where table_schema = 'public' and table_name like '%schema%';


select 'update '|| table_name || ' set ' || column_name || ' = null where id > 0 and '|| column_name ||' is not null;' from information_schema.columns where table_schema = 'public' and column_name like '%schema%';


update saved_query set schema = null where id > 0 and schema is not null;
update table_schema set schema = null where id > 0 and schema is not null;
update query set schema = null where id > 0 and schema is not null;
update query set tmp_schema_name = null where id > 0 and tmp_schema_name is not null;
update tab_state set schema = null where id > 0 and schema is not null;
update slices set schema_perm = null where id > 0 and schema_perm is not null;
update dbs set force_ctas_schema = null where id > 0 and force_ctas_schema is not null;
update tables set schema = null where id > 0 and schema is not null;
update tables set schema_perm = null where id > 0 and schema_perm is not null;
update sl_tables set schema = null where id > 0 and schema is not null;



select 'select '|| column_name || ' from ' || table_name || ' where id > 0 and '|| column_name ||' is not null limit 1;' from information_schema.columns where table_schema = 'public' and column_name like '%schema%';


select schema from saved_query where id > 0 and schema is not null limit 1;
select schema from table_schema where id > 0 and schema is not null limit 1;
select schema from query where id > 0 and schema is not null limit 1;
select tmp_schema_name from query where id > 0 and tmp_schema_name is not null limit 1;
select schema from tab_state where id > 0 and schema is not null limit 1;
select schema_perm from slices where id > 0 and schema_perm is not null limit 1;
select force_ctas_schema from dbs where id > 0 and force_ctas_schema is not null limit 1;
select schema from tables where id > 0 and schema is not null limit 1;
select schema_perm from tables where id > 0 and schema_perm is not null limit 1;
select schema from sl_tables where id > 0 and schema is not null limit 1;
6 changes: 4 additions & 2 deletions reportingSystem/superset_db_sqllite_to_postgres.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ pgloader pgloaderdataonly.conf > db_transfer.txt


6. reset the sequence [/assets/reset_sequence.sql](https://github.com/avniproject/avni-infra/blob/master/reportingSystem/superset/assets/reset_sequence.sql) .so, we don't get error for further update. if sequence not used and give error ignore that.


7. go to container and run db commands. if any error then try to resolve here. don't move further
7. remove schema from the table [/assets/remove_schema.sql](https://github.com/avniproject/avni-infra/blob/master/reportingSystem/superset/assets/remove_schema.sql).
Superset removed schema search for public. [Reference](https://github.com/apache/superset/blob/4.0.2/superset/db_engine_specs/postgres.py#L256)

8. go to container and run db commands. if any error then try to resolve here. don't move further
```shell
docker exec -it -u root superset_2.0.1 bash
superset db upgrade
Expand Down

0 comments on commit ca76b04

Please sign in to comment.