Display graph resources in database
(l)
| 95 | @cli.command() |
| 96 | @click.option("-l", is_flag=True, help="List sub resources recursively") |
| 97 | def ls(l): # noqa: F811, E741 |
| 98 | """Display graph resources in database""" |
| 99 | tree = TreeDisplay() |
| 100 | try: |
| 101 | graphs = list_graphs() |
| 102 | for g in graphs: |
| 103 | # schema |
| 104 | tree.create_graph_node(g, recursive=l) |
| 105 | if l: |
| 106 | # data source mapping |
| 107 | datasource_mapping = get_datasource_by_id(g.id) |
| 108 | tree.create_datasource_mapping_node(g, datasource_mapping) |
| 109 | # stored procedure |
| 110 | stored_procedures = list_stored_procedures(g.id) |
| 111 | tree.create_stored_procedure_node(g, stored_procedures) |
| 112 | # job |
| 113 | jobs = list_jobs() |
| 114 | tree.create_job_node(g, jobs) |
| 115 | except Exception as e: |
| 116 | err(f"Failed to list resources: {str(e)}") |
| 117 | else: |
| 118 | tree.show() |
| 119 | if not l: |
| 120 | info("Run `gsctl ls -l` to list all resources recursively.") |
| 121 | |
| 122 | |
| 123 | @create.command() |
nothing calls this directly
no test coverage detected