project map script | semantic parcer
This commit is contained in:
@@ -49,4 +49,4 @@ async def get_current_user(token: str = Depends(oauth2_scheme)):
|
||||
)
|
||||
# A real implementation would return a user object.
|
||||
return {"placeholder_user": "user@example.com"}
|
||||
# [/DEF]
|
||||
# [/DEF:AuthModule:Module]
|
||||
@@ -24,7 +24,7 @@ router = APIRouter()
|
||||
class ScheduleSchema(BaseModel):
|
||||
enabled: bool = False
|
||||
cron_expression: str = Field(..., pattern=r'^(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|((((\d+,)*\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})$')
|
||||
# [/DEF:ScheduleSchema]
|
||||
# [/DEF:ScheduleSchema:DataClass]
|
||||
|
||||
# [DEF:EnvironmentResponse:DataClass]
|
||||
class EnvironmentResponse(BaseModel):
|
||||
@@ -32,14 +32,14 @@ class EnvironmentResponse(BaseModel):
|
||||
name: str
|
||||
url: str
|
||||
backup_schedule: Optional[ScheduleSchema] = None
|
||||
# [/DEF:EnvironmentResponse]
|
||||
# [/DEF:EnvironmentResponse:DataClass]
|
||||
|
||||
# [DEF:DatabaseResponse:DataClass]
|
||||
class DatabaseResponse(BaseModel):
|
||||
uuid: str
|
||||
database_name: str
|
||||
engine: Optional[str]
|
||||
# [/DEF:DatabaseResponse]
|
||||
# [/DEF:DatabaseResponse:DataClass]
|
||||
|
||||
# [DEF:get_environments:Function]
|
||||
# @PURPOSE: List all configured environments.
|
||||
@@ -61,7 +61,7 @@ async def get_environments(config_manager=Depends(get_config_manager)):
|
||||
) if e.backup_schedule else None
|
||||
) for e in envs
|
||||
]
|
||||
# [/DEF:get_environments]
|
||||
# [/DEF:get_environments:Function]
|
||||
|
||||
# [DEF:update_environment_schedule:Function]
|
||||
# @PURPOSE: Update backup schedule for an environment.
|
||||
@@ -89,7 +89,7 @@ async def update_environment_schedule(
|
||||
scheduler_service.load_schedules()
|
||||
|
||||
return {"message": "Schedule updated successfully"}
|
||||
# [/DEF:update_environment_schedule]
|
||||
# [/DEF:update_environment_schedule:Function]
|
||||
|
||||
# [DEF:get_environment_databases:Function]
|
||||
# @PURPOSE: Fetch the list of databases from a specific environment.
|
||||
@@ -119,6 +119,6 @@ async def get_environment_databases(id: str, config_manager=Depends(get_config_m
|
||||
return client.get_databases_summary()
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=f"Failed to fetch databases: {str(e)}")
|
||||
# [/DEF:get_environment_databases]
|
||||
# [/DEF:get_environment_databases:Function]
|
||||
|
||||
# [/DEF:backend.src.api.routes.environments]
|
||||
# [/DEF:backend.src.api.routes.environments:Module]
|
||||
|
||||
@@ -29,7 +29,7 @@ class MappingCreate(BaseModel):
|
||||
target_db_uuid: str
|
||||
source_db_name: str
|
||||
target_db_name: str
|
||||
# [/DEF:MappingCreate]
|
||||
# [/DEF:MappingCreate:DataClass]
|
||||
|
||||
# [DEF:MappingResponse:DataClass]
|
||||
class MappingResponse(BaseModel):
|
||||
@@ -43,13 +43,13 @@ class MappingResponse(BaseModel):
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
# [/DEF:MappingResponse]
|
||||
# [/DEF:MappingResponse:DataClass]
|
||||
|
||||
# [DEF:SuggestRequest:DataClass]
|
||||
class SuggestRequest(BaseModel):
|
||||
source_env_id: str
|
||||
target_env_id: str
|
||||
# [/DEF:SuggestRequest]
|
||||
# [/DEF:SuggestRequest:DataClass]
|
||||
|
||||
# [DEF:get_mappings:Function]
|
||||
# @PURPOSE: List all saved database mappings.
|
||||
@@ -65,7 +65,7 @@ async def get_mappings(
|
||||
if target_env_id:
|
||||
query = query.filter(DatabaseMapping.target_env_id == target_env_id)
|
||||
return query.all()
|
||||
# [/DEF:get_mappings]
|
||||
# [/DEF:get_mappings:Function]
|
||||
|
||||
# [DEF:create_mapping:Function]
|
||||
# @PURPOSE: Create or update a database mapping.
|
||||
@@ -90,7 +90,7 @@ async def create_mapping(mapping: MappingCreate, db: Session = Depends(get_db)):
|
||||
db.commit()
|
||||
db.refresh(new_mapping)
|
||||
return new_mapping
|
||||
# [/DEF:create_mapping]
|
||||
# [/DEF:create_mapping:Function]
|
||||
|
||||
# [DEF:suggest_mappings_api:Function]
|
||||
# @PURPOSE: Get suggested mappings based on fuzzy matching.
|
||||
@@ -105,6 +105,6 @@ async def suggest_mappings_api(
|
||||
return await service.get_suggestions(request.source_env_id, request.target_env_id)
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
# [/DEF:suggest_mappings_api]
|
||||
# [/DEF:suggest_mappings_api:Function]
|
||||
|
||||
# [/DEF:backend.src.api.routes.mappings]
|
||||
# [/DEF:backend.src.api.routes.mappings:Module]
|
||||
|
||||
@@ -37,7 +37,7 @@ async def get_dashboards(env_id: str, config_manager=Depends(get_config_manager)
|
||||
client = SupersetClient(config)
|
||||
dashboards = client.get_dashboards_summary()
|
||||
return dashboards
|
||||
# [/DEF:get_dashboards]
|
||||
# [/DEF:get_dashboards:Function]
|
||||
|
||||
# [DEF:execute_migration:Function]
|
||||
# @PURPOSE: Execute the migration of selected dashboards.
|
||||
@@ -71,6 +71,6 @@ async def execute_migration(selection: DashboardSelection, config_manager=Depend
|
||||
except Exception as e:
|
||||
logger.error(f"Task creation failed: {e}")
|
||||
raise HTTPException(status_code=500, detail=f"Failed to create migration task: {str(e)}")
|
||||
# [/DEF:execute_migration]
|
||||
# [/DEF:execute_migration:Function]
|
||||
|
||||
# [/DEF:backend.src.api.routes.migration]
|
||||
# [/DEF:backend.src.api.routes.migration:Module]
|
||||
@@ -19,4 +19,4 @@ async def list_plugins(
|
||||
Retrieve a list of all available plugins.
|
||||
"""
|
||||
return plugin_loader.get_all_plugin_configs()
|
||||
# [/DEF]
|
||||
# [/DEF:PluginsRouter:Module]
|
||||
@@ -35,7 +35,7 @@ async def get_settings(config_manager: ConfigManager = Depends(get_config_manage
|
||||
if env.password:
|
||||
env.password = "********"
|
||||
return config
|
||||
# [/DEF:get_settings]
|
||||
# [/DEF:get_settings:Function]
|
||||
|
||||
# [DEF:update_global_settings:Function]
|
||||
# @PURPOSE: Updates global application settings.
|
||||
@@ -49,7 +49,7 @@ async def update_global_settings(
|
||||
logger.info("[update_global_settings][Entry] Updating global settings")
|
||||
config_manager.update_global_settings(settings)
|
||||
return settings
|
||||
# [/DEF:update_global_settings]
|
||||
# [/DEF:update_global_settings:Function]
|
||||
|
||||
# [DEF:get_environments:Function]
|
||||
# @PURPOSE: Lists all configured Superset environments.
|
||||
@@ -58,7 +58,7 @@ async def update_global_settings(
|
||||
async def get_environments(config_manager: ConfigManager = Depends(get_config_manager)):
|
||||
logger.info("[get_environments][Entry] Fetching environments")
|
||||
return config_manager.get_environments()
|
||||
# [/DEF:get_environments]
|
||||
# [/DEF:get_environments:Function]
|
||||
|
||||
# [DEF:add_environment:Function]
|
||||
# @PURPOSE: Adds a new Superset environment.
|
||||
@@ -91,7 +91,7 @@ async def add_environment(
|
||||
|
||||
config_manager.add_environment(env)
|
||||
return env
|
||||
# [/DEF:add_environment]
|
||||
# [/DEF:add_environment:Function]
|
||||
|
||||
# [DEF:update_environment:Function]
|
||||
# @PURPOSE: Updates an existing Superset environment.
|
||||
@@ -134,7 +134,7 @@ async def update_environment(
|
||||
if config_manager.update_environment(id, env):
|
||||
return env
|
||||
raise HTTPException(status_code=404, detail=f"Environment {id} not found")
|
||||
# [/DEF:update_environment]
|
||||
# [/DEF:update_environment:Function]
|
||||
|
||||
# [DEF:delete_environment:Function]
|
||||
# @PURPOSE: Deletes a Superset environment.
|
||||
@@ -147,7 +147,7 @@ async def delete_environment(
|
||||
logger.info(f"[delete_environment][Entry] Deleting environment {id}")
|
||||
config_manager.delete_environment(id)
|
||||
return {"message": f"Environment {id} deleted"}
|
||||
# [/DEF:delete_environment]
|
||||
# [/DEF:delete_environment:Function]
|
||||
|
||||
# [DEF:test_environment_connection:Function]
|
||||
# @PURPOSE: Tests the connection to a Superset environment.
|
||||
@@ -190,7 +190,7 @@ async def test_environment_connection(
|
||||
except Exception as e:
|
||||
logger.error(f"[test_environment_connection][Coherence:Failed] Connection failed for {id}: {e}")
|
||||
return {"status": "error", "message": str(e)}
|
||||
# [/DEF:test_environment_connection]
|
||||
# [/DEF:test_environment_connection:Function]
|
||||
|
||||
# [DEF:validate_backup_path:Function]
|
||||
# @PURPOSE: Validates if a backup path exists and is writable.
|
||||
@@ -213,6 +213,6 @@ async def validate_backup_path(
|
||||
return {"status": "error", "message": message}
|
||||
|
||||
return {"status": "success", "message": message}
|
||||
# [/DEF:validate_backup_path]
|
||||
# [/DEF:validate_backup_path:Function]
|
||||
|
||||
# [/DEF:SettingsRouter]
|
||||
# [/DEF:SettingsRouter:Module]
|
||||
|
||||
@@ -117,4 +117,4 @@ async def clear_tasks(
|
||||
"""
|
||||
task_manager.clear_tasks(status)
|
||||
return
|
||||
# [/DEF]
|
||||
# [/DEF:TasksRouter:Module]
|
||||
Reference in New Issue
Block a user