mass import fix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@ keyring passwords.py
|
|||||||
*github*
|
*github*
|
||||||
*venv*
|
*venv*
|
||||||
*git*
|
*git*
|
||||||
|
*tech_spec*
|
||||||
|
|||||||
Binary file not shown.
@@ -235,15 +235,18 @@ class Migration:
|
|||||||
with create_temp_file(content=exported_content, suffix=".zip", logger=self.logger) as tmp_zip_path, \
|
with create_temp_file(content=exported_content, suffix=".zip", logger=self.logger) as tmp_zip_path, \
|
||||||
create_temp_file(suffix=".dir", logger=self.logger) as tmp_unpack_dir:
|
create_temp_file(suffix=".dir", logger=self.logger) as tmp_unpack_dir:
|
||||||
|
|
||||||
with zipfile.ZipFile(tmp_zip_path, "r") as zip_ref:
|
if not self.db_config_replacement:
|
||||||
zip_ref.extractall(tmp_unpack_dir)
|
self.to_c.import_dashboard(file_name=tmp_zip_path, dash_id=dash_id, dash_slug=dash_slug)
|
||||||
|
else:
|
||||||
if self.db_config_replacement:
|
with zipfile.ZipFile(tmp_zip_path, "r") as zip_ref:
|
||||||
update_yamls(db_configs=[self.db_config_replacement], path=str(tmp_unpack_dir))
|
zip_ref.extractall(tmp_unpack_dir)
|
||||||
|
|
||||||
with create_temp_file(suffix=".zip", logger=self.logger) as tmp_new_zip:
|
if self.db_config_replacement:
|
||||||
create_dashboard_export(zip_path=tmp_new_zip, source_paths=[str(tmp_unpack_dir)])
|
update_yamls(db_configs=[self.db_config_replacement], path=str(tmp_unpack_dir))
|
||||||
self.to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug)
|
|
||||||
|
with create_temp_file(suffix=".zip", logger=self.logger) as tmp_new_zip:
|
||||||
|
create_dashboard_export(zip_path=tmp_new_zip, source_paths=[str(tmp_unpack_dir)])
|
||||||
|
self.to_c.import_dashboard(file_name=tmp_new_zip, dash_id=dash_id, dash_slug=dash_slug)
|
||||||
|
|
||||||
self.logger.info("[execute_migration][Success] Dashboard %s imported.", title)
|
self.logger.info("[execute_migration][Success] Dashboard %s imported.", title)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
# <IMPORTS>
|
# <IMPORTS>
|
||||||
import argparse
|
import argparse
|
||||||
|
import keyring
|
||||||
from superset_tool.utils.init_clients import setup_clients
|
from superset_tool.utils.init_clients import setup_clients
|
||||||
from superset_tool.utils.logger import SupersetLogger
|
from superset_tool.utils.logger import SupersetLogger
|
||||||
from superset_tool.utils.dataset_mapper import DatasetMapper
|
from superset_tool.utils.dataset_mapper import DatasetMapper
|
||||||
@@ -33,10 +34,10 @@ def main():
|
|||||||
# [AI_NOTE]: Конфигурация БД должна быть вынесена во внешний файл или переменные окружения.
|
# [AI_NOTE]: Конфигурация БД должна быть вынесена во внешний файл или переменные окружения.
|
||||||
POSTGRES_CONFIG = {
|
POSTGRES_CONFIG = {
|
||||||
'dbname': 'dwh',
|
'dbname': 'dwh',
|
||||||
'user': 'your_user',
|
'user': keyring.get_password("system", f"dwh gp user"),
|
||||||
'password': 'your_password',
|
'password': keyring.get_password("system", f"dwh gp password"),
|
||||||
'host': 'your_host',
|
'host': '10.66.229.201',
|
||||||
'port': 'your_port'
|
'port': '5432'
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("[main][Enter] Starting dataset mapper CLI.")
|
logger.info("[main][Enter] Starting dataset mapper CLI.")
|
||||||
|
|||||||
Reference in New Issue
Block a user