dbgraph 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/workspace.xml +63 -41
- {dbgraph-0.2.1 → dbgraph-0.2.2}/PKG-INFO +1 -1
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/dbgraph.py +10 -2
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/render/graph_renderer.py +2 -2
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/render/markdown_renderer.py +4 -9
- {dbgraph-0.2.1 → dbgraph-0.2.2}/pyproject.toml +1 -1
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_markdown_renderer.py +2 -2
- dbgraph-0.2.1/dbgraph/event/event.py +0 -20
- dbgraph-0.2.1/dbgraph/event/event_bus.py +0 -61
- dbgraph-0.2.1/dbgraph/event/event_handler.py +0 -11
- dbgraph-0.2.1/dbgraph/render/text_renderer.py +0 -11
- dbgraph-0.2.1/tests/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.gitignore +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/.gitignore +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/dbgraph.iml +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/misc.xml +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/modules.xml +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/vcs.xml +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/.python-version +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/README.md +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-desc.md +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph-import.db +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph-v2.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph-v4.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph.db +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph.png +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/corpus.jsonl +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/corpus.mmindex.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/data.csc.index.npy +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/indices.csc.index.npy +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/indptr.csc.index.npy +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/params.index.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/vocab.index.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-semantic-v5.json +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind.db +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/data/time-results.txt +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/application.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/builder/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/builder/graph_builder.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/builder/sql_graph_builder.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/graph_descriptor.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/langchain_graph_descriptor.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/prompt_templates.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/aspect.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/asset.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/asset_type.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/link.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/link_type.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/rdbgraph.py +0 -0
- {dbgraph-0.2.1/dbgraph/event → dbgraph-0.2.2/dbgraph/io}/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/graph_loader.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/graph_writer.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/json_graph_loader.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/json_graph_writer.py +0 -0
- {dbgraph-0.2.1/dbgraph/io → dbgraph-0.2.2/dbgraph/persistent}/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/graph_persistent.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/json_utils.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/models.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/sql_graph_persistent.py +0 -0
- {dbgraph-0.2.1/dbgraph/persistent → dbgraph-0.2.2/dbgraph/render}/__init__.py +0 -0
- {dbgraph-0.2.1/dbgraph/render → dbgraph-0.2.2/dbgraph/search}/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/search/bm25_search_engine.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/search/search_engine.py +0 -0
- {dbgraph-0.2.1/dbgraph/search → dbgraph-0.2.2/dbgraph/utils}/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/utils/singleton.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/entity.png +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/entity.txt +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/usecase.png +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/usecase.txt +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/docs/index.md +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/docs/refs/aspect.md +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/docs/refs/graph.md +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/main.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/mkdocs.yml +0 -0
- {dbgraph-0.2.1/dbgraph/utils → dbgraph-0.2.2/tests}/__init__.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_application.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_bm25s_search_engine.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_dbgraph.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_json_graph_loader.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_json_graph_writer.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_langchain_graph_descriptor.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_load_graph_sql.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_rdbgraph.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_sql_graph_builder.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_sql_graph_persistent.py +0 -0
- {dbgraph-0.2.1 → dbgraph-0.2.2}/uv.lock +0 -0
|
@@ -4,15 +4,8 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="263a96da-9a82-40fd-89b2-ba71dd2c194d" name="Changes" comment="
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/dbgraph/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/dbgraph/__init__.py" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/dbgraph/builder/sql_graph_builder.py" beforeDir="false" afterPath="$PROJECT_DIR$/dbgraph/builder/sql_graph_builder.py" afterDir="false" />
|
|
10
|
-
<change beforePath="$PROJECT_DIR$/dbgraph/entity/aspect.py" beforeDir="false" afterPath="$PROJECT_DIR$/dbgraph/entity/aspect.py" afterDir="false" />
|
|
11
|
-
<change beforePath="$PROJECT_DIR$/dbgraph/persistent/json_utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/dbgraph/persistent/json_utils.py" afterDir="false" />
|
|
12
|
-
<change beforePath="$PROJECT_DIR$/dbgraph/persistent/sql_graph_persistent.py" beforeDir="false" afterPath="$PROJECT_DIR$/dbgraph/persistent/sql_graph_persistent.py" afterDir="false" />
|
|
7
|
+
<list default="true" id="263a96da-9a82-40fd-89b2-ba71dd2c194d" name="Changes" comment="update renderer">
|
|
13
8
|
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
|
|
14
|
-
<change beforePath="$PROJECT_DIR$/tests/test_load_graph_sql.py" beforeDir="false" afterPath="$PROJECT_DIR$/tests/test_load_graph_sql.py" afterDir="false" />
|
|
15
|
-
<change beforePath="$PROJECT_DIR$/tests/test_sql_graph_persistent.py" beforeDir="false" afterPath="$PROJECT_DIR$/tests/test_sql_graph_persistent.py" afterDir="false" />
|
|
16
9
|
</list>
|
|
17
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
18
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -69,28 +62,30 @@
|
|
|
69
62
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
70
63
|
<option name="showLibraryContents" value="true" />
|
|
71
64
|
</component>
|
|
72
|
-
<component name="PropertiesComponent"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
65
|
+
<component name="PropertiesComponent">{
|
|
66
|
+
"keyToString": {
|
|
67
|
+
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
|
68
|
+
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
|
69
|
+
"Python tests.Python tests for tests.test_dbgraph.TestDBGraph.executor": "Run",
|
|
70
|
+
"Python tests.Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load.executor": "Run",
|
|
71
|
+
"Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.executor": "Run",
|
|
72
|
+
"Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links.executor": "Run",
|
|
73
|
+
"Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph.executor": "Run",
|
|
74
|
+
"Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.executor": "Run",
|
|
75
|
+
"Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_load_graph.executor": "Run",
|
|
76
|
+
"Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_save_graph.executor": "Run",
|
|
77
|
+
"Python tests.Python tests in test_load_graph_sql.py.executor": "Run",
|
|
78
|
+
"Python tests.Python tests in tests.executor": "Run",
|
|
79
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
80
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
81
|
+
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
|
82
|
+
"codeWithMe.voiceChat.enabledByDefault": "false",
|
|
83
|
+
"git-widget-placeholder": "main",
|
|
84
|
+
"ignore.virus.scanning.warn.message": "true",
|
|
85
|
+
"nodejs_package_manager_path": "npm",
|
|
86
|
+
"settings.editor.selected.configurable": "editor.preferences.folding"
|
|
92
87
|
}
|
|
93
|
-
}
|
|
88
|
+
}</component>
|
|
94
89
|
<component name="RunManager" selected="Python tests.Python tests in tests">
|
|
95
90
|
<configuration name="Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
96
91
|
<module name="dbgraph" />
|
|
@@ -109,7 +104,7 @@
|
|
|
109
104
|
<option name="_new_targetType" value=""PYTHON"" />
|
|
110
105
|
<method v="2" />
|
|
111
106
|
</configuration>
|
|
112
|
-
<configuration name="Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder
|
|
107
|
+
<configuration name="Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
113
108
|
<module name="dbgraph" />
|
|
114
109
|
<option name="ENV_FILES" value="" />
|
|
115
110
|
<option name="INTERPRETER_OPTIONS" value="" />
|
|
@@ -122,11 +117,11 @@
|
|
|
122
117
|
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
123
118
|
<option name="RUN_TOOL" value="" />
|
|
124
119
|
<option name="_new_additionalArguments" value="""" />
|
|
125
|
-
<option name="_new_target" value=""tests.test_sql_graph_builder.TestSQLGraphBuilder
|
|
120
|
+
<option name="_new_target" value=""tests.test_sql_graph_builder.TestSQLGraphBuilder"" />
|
|
126
121
|
<option name="_new_targetType" value=""PYTHON"" />
|
|
127
122
|
<method v="2" />
|
|
128
123
|
</configuration>
|
|
129
|
-
<configuration name="Python tests for tests.
|
|
124
|
+
<configuration name="Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
130
125
|
<module name="dbgraph" />
|
|
131
126
|
<option name="ENV_FILES" value="" />
|
|
132
127
|
<option name="INTERPRETER_OPTIONS" value="" />
|
|
@@ -139,11 +134,11 @@
|
|
|
139
134
|
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
140
135
|
<option name="RUN_TOOL" value="" />
|
|
141
136
|
<option name="_new_additionalArguments" value="""" />
|
|
142
|
-
<option name="_new_target" value=""tests.
|
|
137
|
+
<option name="_new_target" value=""tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links"" />
|
|
143
138
|
<option name="_new_targetType" value=""PYTHON"" />
|
|
144
139
|
<method v="2" />
|
|
145
140
|
</configuration>
|
|
146
|
-
<configuration name="Python tests
|
|
141
|
+
<configuration name="Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
147
142
|
<module name="dbgraph" />
|
|
148
143
|
<option name="ENV_FILES" value="" />
|
|
149
144
|
<option name="INTERPRETER_OPTIONS" value="" />
|
|
@@ -156,8 +151,8 @@
|
|
|
156
151
|
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
157
152
|
<option name="RUN_TOOL" value="" />
|
|
158
153
|
<option name="_new_additionalArguments" value="""" />
|
|
159
|
-
<option name="_new_target" value=""
|
|
160
|
-
<option name="_new_targetType" value=""
|
|
154
|
+
<option name="_new_target" value=""tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph"" />
|
|
155
|
+
<option name="_new_targetType" value=""PYTHON"" />
|
|
161
156
|
<method v="2" />
|
|
162
157
|
</configuration>
|
|
163
158
|
<configuration name="Python tests in tests" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
@@ -180,10 +175,10 @@
|
|
|
180
175
|
<recent_temporary>
|
|
181
176
|
<list>
|
|
182
177
|
<item itemvalue="Python tests.Python tests in tests" />
|
|
183
|
-
<item itemvalue="Python tests.Python tests for tests.
|
|
184
|
-
<item itemvalue="Python tests.Python tests
|
|
185
|
-
<item itemvalue="Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent" />
|
|
178
|
+
<item itemvalue="Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder" />
|
|
179
|
+
<item itemvalue="Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links" />
|
|
186
180
|
<item itemvalue="Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph" />
|
|
181
|
+
<item itemvalue="Python tests.Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load" />
|
|
187
182
|
</list>
|
|
188
183
|
</recent_temporary>
|
|
189
184
|
</component>
|
|
@@ -226,7 +221,31 @@
|
|
|
226
221
|
<option name="project" value="LOCAL" />
|
|
227
222
|
<updated>1788407330419</updated>
|
|
228
223
|
</task>
|
|
229
|
-
<
|
|
224
|
+
<task id="LOCAL-00004" summary="format">
|
|
225
|
+
<option name="closed" value="true" />
|
|
226
|
+
<created>1788407896437</created>
|
|
227
|
+
<option name="number" value="00004" />
|
|
228
|
+
<option name="presentableId" value="LOCAL-00004" />
|
|
229
|
+
<option name="project" value="LOCAL" />
|
|
230
|
+
<updated>1788407896437</updated>
|
|
231
|
+
</task>
|
|
232
|
+
<task id="LOCAL-00005" summary="remove events">
|
|
233
|
+
<option name="closed" value="true" />
|
|
234
|
+
<created>1788576856001</created>
|
|
235
|
+
<option name="number" value="00005" />
|
|
236
|
+
<option name="presentableId" value="LOCAL-00005" />
|
|
237
|
+
<option name="project" value="LOCAL" />
|
|
238
|
+
<updated>1788576856001</updated>
|
|
239
|
+
</task>
|
|
240
|
+
<task id="LOCAL-00006" summary="update renderer">
|
|
241
|
+
<option name="closed" value="true" />
|
|
242
|
+
<created>1788922273132</created>
|
|
243
|
+
<option name="number" value="00006" />
|
|
244
|
+
<option name="presentableId" value="LOCAL-00006" />
|
|
245
|
+
<option name="project" value="LOCAL" />
|
|
246
|
+
<updated>1788922273132</updated>
|
|
247
|
+
</task>
|
|
248
|
+
<option name="localTasksCounter" value="7" />
|
|
230
249
|
<servers />
|
|
231
250
|
</component>
|
|
232
251
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -246,7 +265,10 @@
|
|
|
246
265
|
<component name="VcsManagerConfiguration">
|
|
247
266
|
<MESSAGE value="update packaging" />
|
|
248
267
|
<MESSAGE value="fix bugs in builder" />
|
|
249
|
-
<
|
|
268
|
+
<MESSAGE value="format" />
|
|
269
|
+
<MESSAGE value="remove events" />
|
|
270
|
+
<MESSAGE value="update renderer" />
|
|
271
|
+
<option name="LAST_COMMIT_MESSAGE" value="update renderer" />
|
|
250
272
|
</component>
|
|
251
273
|
<component name="XDebuggerManager">
|
|
252
274
|
<breakpoint-manager>
|
|
@@ -7,6 +7,10 @@ import rustworkx as rx
|
|
|
7
7
|
|
|
8
8
|
from dbgraph.entity.asset import Asset
|
|
9
9
|
from dbgraph.entity.link import Link
|
|
10
|
+
from typing import TYPE_CHECKING
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from dbgraph.entity.rdbgraph import RDatabaseGraph
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
@dataclass
|
|
@@ -88,7 +92,7 @@ class DatabaseGraph:
|
|
|
88
92
|
|
|
89
93
|
def select_shortest_paths(self, src_id: str, dst_id: str) -> list[DatabaseGraph]:
|
|
90
94
|
"""
|
|
91
|
-
Find shortest paths between two Assets.
|
|
95
|
+
Find the shortest paths between two Assets.
|
|
92
96
|
|
|
93
97
|
Args:
|
|
94
98
|
src_id: ID of the source asset
|
|
@@ -135,7 +139,7 @@ class DatabaseGraph:
|
|
|
135
139
|
return [self._graph.get_node_data(i) for i in asset_indices]
|
|
136
140
|
|
|
137
141
|
def find_shortest_paths(self, src_id: str, dst_id: str) -> list[list[Asset]]:
|
|
138
|
-
"""Find shortest paths between two Assets
|
|
142
|
+
"""Find the shortest paths between two Assets
|
|
139
143
|
|
|
140
144
|
Args:
|
|
141
145
|
src_id: ID of the source asset
|
|
@@ -150,3 +154,7 @@ class DatabaseGraph:
|
|
|
150
154
|
paths = rx.all_shortest_paths(self._graph, src_idx, dst_idx)
|
|
151
155
|
|
|
152
156
|
return [[self._graph.get_node_data(i) for i in path] for path in paths]
|
|
157
|
+
|
|
158
|
+
def to_relational(self) -> "RDatabaseGraph":
|
|
159
|
+
"""Return the RDatabaseGraph"""
|
|
160
|
+
return RDatabaseGraph.from_graph(self)
|
|
@@ -7,5 +7,5 @@ class GraphRenderer(ABC):
|
|
|
7
7
|
"""Interface for rendering the graph"""
|
|
8
8
|
|
|
9
9
|
@abstractmethod
|
|
10
|
-
def render(self, graph: DatabaseGraph):
|
|
11
|
-
"""Render the graph
|
|
10
|
+
def render(self, graph: DatabaseGraph) -> str:
|
|
11
|
+
"""Render the graph to text-based format"""
|
|
@@ -13,11 +13,11 @@ from dbgraph.entity.asset import Asset
|
|
|
13
13
|
from dbgraph.entity.dbgraph import DatabaseGraph
|
|
14
14
|
from dbgraph.entity.link import Link
|
|
15
15
|
from dbgraph.entity.rdbgraph import RDatabaseGraph
|
|
16
|
-
from dbgraph.render.
|
|
16
|
+
from dbgraph.render.graph_renderer import GraphRenderer
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
@dataclass
|
|
20
|
-
class MarkdownRenderer(
|
|
20
|
+
class MarkdownRenderer(GraphRenderer):
|
|
21
21
|
"""Render the graph to Markdown format"""
|
|
22
22
|
|
|
23
23
|
categorical_value_max_char: int = 50
|
|
@@ -89,7 +89,7 @@ class MarkdownRenderer(TextRenderer):
|
|
|
89
89
|
|
|
90
90
|
return answer
|
|
91
91
|
|
|
92
|
-
def render(self, graph: DatabaseGraph):
|
|
92
|
+
def render(self, graph: DatabaseGraph) -> str:
|
|
93
93
|
graph = RDatabaseGraph.from_graph(graph)
|
|
94
94
|
tables = graph.get_tables()
|
|
95
95
|
answer = ""
|
|
@@ -103,9 +103,4 @@ class MarkdownRenderer(TextRenderer):
|
|
|
103
103
|
answer += "\n# List of Foreign Key Constraints"
|
|
104
104
|
for fk in foreign_keys:
|
|
105
105
|
answer += f"\n{self._dump_fk(fk, graph)}"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def get_content(self) -> str:
|
|
109
|
-
if not self.content:
|
|
110
|
-
raise RuntimeError("Content is empty. Please run `render()` first!")
|
|
111
|
-
return self.content
|
|
106
|
+
return answer
|
|
@@ -12,8 +12,8 @@ class TestMarkdownRenderer(unittest.TestCase):
|
|
|
12
12
|
self.renderer = MarkdownRenderer()
|
|
13
13
|
|
|
14
14
|
def test_render(self):
|
|
15
|
-
self.renderer.render(self.graph)
|
|
16
|
-
self.assertIsInstance(
|
|
15
|
+
markdown = self.renderer.render(self.graph)
|
|
16
|
+
self.assertIsInstance(markdown, str)
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
if __name__ == "__main__":
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
@dataclass
|
|
5
|
-
class Event:
|
|
6
|
-
"""Base event used in DBGraph"""
|
|
7
|
-
|
|
8
|
-
message: str
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@dataclass
|
|
12
|
-
class ProgressEvent(Event):
|
|
13
|
-
"""Event with progress"""
|
|
14
|
-
|
|
15
|
-
target: float
|
|
16
|
-
current: float
|
|
17
|
-
|
|
18
|
-
def get_percentage(self) -> float:
|
|
19
|
-
"""Return the progress of the task in percentage"""
|
|
20
|
-
return self.current / self.target
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import queue
|
|
2
|
-
import threading
|
|
3
|
-
|
|
4
|
-
from dbgraph.event.event import Event
|
|
5
|
-
from dbgraph.event.event_handler import EventHandler
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class EventBus:
|
|
9
|
-
"""Store events in a queue and manage a background thread to distribute events"""
|
|
10
|
-
|
|
11
|
-
def __init__(self) -> None:
|
|
12
|
-
self.queue = queue.Queue()
|
|
13
|
-
self.handlers: dict[type[Event], set[EventHandler]] = {}
|
|
14
|
-
self._thread: threading.Thread | None = None
|
|
15
|
-
self._stop_event = threading.Event()
|
|
16
|
-
|
|
17
|
-
def subscribe(self, event_type: type[Event], handler: EventHandler):
|
|
18
|
-
"""Subscribe a handler to specific type of event"""
|
|
19
|
-
if event_type in self.handlers:
|
|
20
|
-
self.handlers[event_type].add(handler)
|
|
21
|
-
else:
|
|
22
|
-
self.handlers[event_type] = {handler}
|
|
23
|
-
|
|
24
|
-
def unsubscribe(self, event_type: type[Event], handler: EventHandler):
|
|
25
|
-
"""Unsubscribe a handler from listening to specific event type"""
|
|
26
|
-
self.handlers[event_type].remove(handler)
|
|
27
|
-
|
|
28
|
-
def publish(self, event: Event):
|
|
29
|
-
"""Push an event into the event queue"""
|
|
30
|
-
self.queue.put(event)
|
|
31
|
-
|
|
32
|
-
def _dispatch(self):
|
|
33
|
-
"""Get the latest event and let the appropriate handler process it"""
|
|
34
|
-
event = self.queue.get()
|
|
35
|
-
for handler in self.handlers[type(event)]:
|
|
36
|
-
handler.handle(event)
|
|
37
|
-
|
|
38
|
-
def _run(self):
|
|
39
|
-
"""Run the event loop"""
|
|
40
|
-
while not self._stop_event.is_set():
|
|
41
|
-
try:
|
|
42
|
-
self._dispatch()
|
|
43
|
-
except queue.Empty:
|
|
44
|
-
continue
|
|
45
|
-
|
|
46
|
-
def start(self):
|
|
47
|
-
"""Start the event background thread"""
|
|
48
|
-
if self._thread is not None and self._thread.is_alive():
|
|
49
|
-
return
|
|
50
|
-
self._stop_event.clear()
|
|
51
|
-
self._thread = threading.Thread(
|
|
52
|
-
target=self._run, name="dbgraph-event-bus", daemon=True
|
|
53
|
-
)
|
|
54
|
-
self._thread.start()
|
|
55
|
-
|
|
56
|
-
def stop(self):
|
|
57
|
-
"""Stop the event background thread"""
|
|
58
|
-
self._stop_event.set()
|
|
59
|
-
if self._thread is not None:
|
|
60
|
-
self._thread.join()
|
|
61
|
-
self._thread = None
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from abc import ABC, abstractmethod
|
|
2
|
-
|
|
3
|
-
from dbgraph.render.graph_renderer import GraphRenderer
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class TextRenderer(GraphRenderer, ABC):
|
|
7
|
-
"""Render the graph to text-based representation"""
|
|
8
|
-
|
|
9
|
-
@abstractmethod
|
|
10
|
-
def get_content(self) -> str:
|
|
11
|
-
"""Get the text data"""
|
dbgraph-0.2.1/tests/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|