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.
Files changed (91) hide show
  1. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/workspace.xml +63 -41
  2. {dbgraph-0.2.1 → dbgraph-0.2.2}/PKG-INFO +1 -1
  3. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/dbgraph.py +10 -2
  4. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/render/graph_renderer.py +2 -2
  5. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/render/markdown_renderer.py +4 -9
  6. {dbgraph-0.2.1 → dbgraph-0.2.2}/pyproject.toml +1 -1
  7. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_markdown_renderer.py +2 -2
  8. dbgraph-0.2.1/dbgraph/event/event.py +0 -20
  9. dbgraph-0.2.1/dbgraph/event/event_bus.py +0 -61
  10. dbgraph-0.2.1/dbgraph/event/event_handler.py +0 -11
  11. dbgraph-0.2.1/dbgraph/render/text_renderer.py +0 -11
  12. dbgraph-0.2.1/tests/__init__.py +0 -0
  13. {dbgraph-0.2.1 → dbgraph-0.2.2}/.gitignore +0 -0
  14. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/.gitignore +0 -0
  15. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/dbgraph.iml +0 -0
  16. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  17. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/misc.xml +0 -0
  18. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/modules.xml +0 -0
  19. {dbgraph-0.2.1 → dbgraph-0.2.2}/.idea/vcs.xml +0 -0
  20. {dbgraph-0.2.1 → dbgraph-0.2.2}/.python-version +0 -0
  21. {dbgraph-0.2.1 → dbgraph-0.2.2}/README.md +0 -0
  22. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-desc.md +0 -0
  23. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph-import.db +0 -0
  24. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph-v2.json +0 -0
  25. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph-v4.json +0 -0
  26. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph.db +0 -0
  27. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph.json +0 -0
  28. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-graph.png +0 -0
  29. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/corpus.jsonl +0 -0
  30. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/corpus.mmindex.json +0 -0
  31. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/data.csc.index.npy +0 -0
  32. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/indices.csc.index.npy +0 -0
  33. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/indptr.csc.index.npy +0 -0
  34. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/params.index.json +0 -0
  35. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-index/vocab.index.json +0 -0
  36. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind-semantic-v5.json +0 -0
  37. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/northwind.db +0 -0
  38. {dbgraph-0.2.1 → dbgraph-0.2.2}/data/time-results.txt +0 -0
  39. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/__init__.py +0 -0
  40. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/application.py +0 -0
  41. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/builder/__init__.py +0 -0
  42. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/builder/graph_builder.py +0 -0
  43. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/builder/sql_graph_builder.py +0 -0
  44. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/__init__.py +0 -0
  45. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/graph_descriptor.py +0 -0
  46. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/langchain_graph_descriptor.py +0 -0
  47. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/descriptor/prompt_templates.py +0 -0
  48. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/__init__.py +0 -0
  49. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/aspect.py +0 -0
  50. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/asset.py +0 -0
  51. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/asset_type.py +0 -0
  52. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/link.py +0 -0
  53. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/link_type.py +0 -0
  54. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/entity/rdbgraph.py +0 -0
  55. {dbgraph-0.2.1/dbgraph/event → dbgraph-0.2.2/dbgraph/io}/__init__.py +0 -0
  56. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/graph_loader.py +0 -0
  57. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/graph_writer.py +0 -0
  58. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/json_graph_loader.py +0 -0
  59. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/io/json_graph_writer.py +0 -0
  60. {dbgraph-0.2.1/dbgraph/io → dbgraph-0.2.2/dbgraph/persistent}/__init__.py +0 -0
  61. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/graph_persistent.py +0 -0
  62. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/json_utils.py +0 -0
  63. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/models.py +0 -0
  64. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/persistent/sql_graph_persistent.py +0 -0
  65. {dbgraph-0.2.1/dbgraph/persistent → dbgraph-0.2.2/dbgraph/render}/__init__.py +0 -0
  66. {dbgraph-0.2.1/dbgraph/render → dbgraph-0.2.2/dbgraph/search}/__init__.py +0 -0
  67. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/search/bm25_search_engine.py +0 -0
  68. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/search/search_engine.py +0 -0
  69. {dbgraph-0.2.1/dbgraph/search → dbgraph-0.2.2/dbgraph/utils}/__init__.py +0 -0
  70. {dbgraph-0.2.1 → dbgraph-0.2.2}/dbgraph/utils/singleton.py +0 -0
  71. {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/entity.png +0 -0
  72. {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/entity.txt +0 -0
  73. {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/usecase.png +0 -0
  74. {dbgraph-0.2.1 → dbgraph-0.2.2}/diagrams/usecase.txt +0 -0
  75. {dbgraph-0.2.1 → dbgraph-0.2.2}/docs/index.md +0 -0
  76. {dbgraph-0.2.1 → dbgraph-0.2.2}/docs/refs/aspect.md +0 -0
  77. {dbgraph-0.2.1 → dbgraph-0.2.2}/docs/refs/graph.md +0 -0
  78. {dbgraph-0.2.1 → dbgraph-0.2.2}/main.py +0 -0
  79. {dbgraph-0.2.1 → dbgraph-0.2.2}/mkdocs.yml +0 -0
  80. {dbgraph-0.2.1/dbgraph/utils → dbgraph-0.2.2/tests}/__init__.py +0 -0
  81. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_application.py +0 -0
  82. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_bm25s_search_engine.py +0 -0
  83. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_dbgraph.py +0 -0
  84. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_json_graph_loader.py +0 -0
  85. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_json_graph_writer.py +0 -0
  86. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_langchain_graph_descriptor.py +0 -0
  87. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_load_graph_sql.py +0 -0
  88. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_rdbgraph.py +0 -0
  89. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_sql_graph_builder.py +0 -0
  90. {dbgraph-0.2.1 → dbgraph-0.2.2}/tests/test_sql_graph_persistent.py +0 -0
  91. {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="fix bugs in builder">
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"><![CDATA[{
73
- "keyToString": {
74
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
75
- "ModuleVcsDetector.initialDetectionPerformed": "true",
76
- "Python tests.Python tests for tests.test_dbgraph.TestDBGraph.executor": "Run",
77
- "Python tests.Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load.executor": "Run",
78
- "Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph.executor": "Run",
79
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.executor": "Run",
80
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_load_graph.executor": "Run",
81
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_save_graph.executor": "Run",
82
- "Python tests.Python tests in test_load_graph_sql.py.executor": "Run",
83
- "Python tests.Python tests in tests.executor": "Run",
84
- "RunOnceActivity.ShowReadmeOnStart": "true",
85
- "RunOnceActivity.git.unshallow": "true",
86
- "RunOnceActivity.typescript.service.memoryLimit.init": "true",
87
- "codeWithMe.voiceChat.enabledByDefault": "false",
88
- "git-widget-placeholder": "main",
89
- "ignore.virus.scanning.warn.message": "true",
90
- "nodejs_package_manager_path": "npm",
91
- "settings.editor.selected.configurable": "editor.preferences.folding"
65
+ <component name="PropertiesComponent">{
66
+ &quot;keyToString&quot;: {
67
+ &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
68
+ &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
69
+ &quot;Python tests.Python tests for tests.test_dbgraph.TestDBGraph.executor&quot;: &quot;Run&quot;,
70
+ &quot;Python tests.Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load.executor&quot;: &quot;Run&quot;,
71
+ &quot;Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.executor&quot;: &quot;Run&quot;,
72
+ &quot;Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links.executor&quot;: &quot;Run&quot;,
73
+ &quot;Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph.executor&quot;: &quot;Run&quot;,
74
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.executor&quot;: &quot;Run&quot;,
75
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_load_graph.executor&quot;: &quot;Run&quot;,
76
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_save_graph.executor&quot;: &quot;Run&quot;,
77
+ &quot;Python tests.Python tests in test_load_graph_sql.py.executor&quot;: &quot;Run&quot;,
78
+ &quot;Python tests.Python tests in tests.executor&quot;: &quot;Run&quot;,
79
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
80
+ &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
81
+ &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
82
+ &quot;codeWithMe.voiceChat.enabledByDefault&quot;: &quot;false&quot;,
83
+ &quot;git-widget-placeholder&quot;: &quot;main&quot;,
84
+ &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
85
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
86
+ &quot;settings.editor.selected.configurable&quot;: &quot;editor.preferences.folding&quot;
92
87
  }
93
- }]]></component>
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="&quot;PYTHON&quot;" />
110
105
  <method v="2" />
111
106
  </configuration>
112
- <configuration name="Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
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="&quot;&quot;" />
125
- <option name="_new_target" value="&quot;tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph&quot;" />
120
+ <option name="_new_target" value="&quot;tests.test_sql_graph_builder.TestSQLGraphBuilder&quot;" />
126
121
  <option name="_new_targetType" value="&quot;PYTHON&quot;" />
127
122
  <method v="2" />
128
123
  </configuration>
129
- <configuration name="Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
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="&quot;&quot;" />
142
- <option name="_new_target" value="&quot;tests.test_sql_graph_persistent.TestSQLGraphPersistent&quot;" />
137
+ <option name="_new_target" value="&quot;tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links&quot;" />
143
138
  <option name="_new_targetType" value="&quot;PYTHON&quot;" />
144
139
  <method v="2" />
145
140
  </configuration>
146
- <configuration name="Python tests in test_load_graph_sql.py" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
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="&quot;&quot;" />
159
- <option name="_new_target" value="&quot;$PROJECT_DIR$/tests/test_load_graph_sql.py&quot;" />
160
- <option name="_new_targetType" value="&quot;PATH&quot;" />
154
+ <option name="_new_target" value="&quot;tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph&quot;" />
155
+ <option name="_new_targetType" value="&quot;PYTHON&quot;" />
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.test_load_graph_sql.TestLoadGraphSQL.test_load" />
184
- <item itemvalue="Python tests.Python tests in test_load_graph_sql.py" />
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
- <option name="localTasksCounter" value="4" />
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
- <option name="LAST_COMMIT_MESSAGE" value="fix bugs in builder" />
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>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dbgraph
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: dbgraph is a database profiling tool which model the database as a graph
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: bm25s>=0.3.9
@@ -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, store data inside the class"""
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.text_renderer import TextRenderer
16
+ from dbgraph.render.graph_renderer import GraphRenderer
17
17
 
18
18
 
19
19
  @dataclass
20
- class MarkdownRenderer(TextRenderer):
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
- self.content = answer
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dbgraph"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "dbgraph is a database profiling tool which model the database as a graph"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -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(self.renderer.get_content(), str)
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.event.event import Event
4
-
5
-
6
- class EventHandler(ABC):
7
- """Interface for event handler"""
8
-
9
- @abstractmethod
10
- def handle(self, event: Event):
11
- """Handle the event"""
@@ -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"""
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