dbgraph 0.2.0__tar.gz → 0.2.1__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/.idea/workspace.xml +267 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/PKG-INFO +2 -2
- dbgraph-0.2.1/data/northwind-graph-import.db +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/__init__.py +1 -1
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/builder/sql_graph_builder.py +41 -6
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/aspect.py +12 -0
- dbgraph-0.2.1/dbgraph/persistent/json_utils.py +34 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/persistent/models.py +4 -4
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/persistent/sql_graph_persistent.py +16 -11
- {dbgraph-0.2.0 → dbgraph-0.2.1}/pyproject.toml +2 -2
- dbgraph-0.2.1/tests/test_load_graph_sql.py +21 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_sql_graph_builder.py +1 -1
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_sql_graph_persistent.py +6 -5
- {dbgraph-0.2.0 → dbgraph-0.2.1}/uv.lock +2 -2
- dbgraph-0.2.0/.idea/workspace.xml +0 -168
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.gitignore +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.idea/.gitignore +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.idea/dbgraph.iml +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.idea/misc.xml +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.idea/modules.xml +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.idea/vcs.xml +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/.python-version +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/README.md +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-desc.md +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-graph-v2.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-graph-v4.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-graph.db +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-graph.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-graph.png +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/corpus.jsonl +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/corpus.mmindex.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/data.csc.index.npy +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/indices.csc.index.npy +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/indptr.csc.index.npy +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/params.index.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-index/vocab.index.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind-semantic-v5.json +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/northwind.db +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/data/time-results.txt +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/application.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/builder/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/builder/graph_builder.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/descriptor/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/descriptor/graph_descriptor.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/descriptor/langchain_graph_descriptor.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/descriptor/prompt_templates.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/asset.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/asset_type.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/dbgraph.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/link.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/link_type.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/entity/rdbgraph.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/event/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/event/event.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/event/event_bus.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/event/event_handler.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/io/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/io/graph_loader.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/io/graph_writer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/io/json_graph_loader.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/io/json_graph_writer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/persistent/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/persistent/graph_persistent.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/render/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/render/graph_renderer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/render/markdown_renderer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/render/text_renderer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/search/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/search/bm25_search_engine.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/search/search_engine.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/utils/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/dbgraph/utils/singleton.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/diagrams/entity.png +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/diagrams/entity.txt +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/diagrams/usecase.png +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/diagrams/usecase.txt +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/docs/index.md +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/docs/refs/aspect.md +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/docs/refs/graph.md +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/main.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/mkdocs.yml +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/__init__.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_application.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_bm25s_search_engine.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_dbgraph.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_json_graph_loader.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_json_graph_writer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_langchain_graph_descriptor.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_markdown_renderer.py +0 -0
- {dbgraph-0.2.0 → dbgraph-0.2.1}/tests/test_rdbgraph.py +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
+
</component>
|
|
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" />
|
|
13
|
+
<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
|
+
</list>
|
|
17
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
18
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
19
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
20
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
21
|
+
</component>
|
|
22
|
+
<component name="FileTemplateManagerImpl">
|
|
23
|
+
<option name="RECENT_TEMPLATES">
|
|
24
|
+
<list>
|
|
25
|
+
<option value="Python Unit Test" />
|
|
26
|
+
<option value="Python Script" />
|
|
27
|
+
</list>
|
|
28
|
+
</option>
|
|
29
|
+
</component>
|
|
30
|
+
<component name="Git.Settings">
|
|
31
|
+
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
|
32
|
+
<map>
|
|
33
|
+
<entry key="$PROJECT_DIR$" value="packaging" />
|
|
34
|
+
</map>
|
|
35
|
+
</option>
|
|
36
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
37
|
+
</component>
|
|
38
|
+
<component name="GitHubPullRequestSearchHistory">{
|
|
39
|
+
"lastFilter": {
|
|
40
|
+
"state": "OPEN",
|
|
41
|
+
"assignee": "minhdenthedev"
|
|
42
|
+
}
|
|
43
|
+
}</component>
|
|
44
|
+
<component name="GithubPullRequestsUISettings">{
|
|
45
|
+
"selectedUrlAndAccountId": {
|
|
46
|
+
"url": "https://github.com/minhdenthedev/dbgraph.git",
|
|
47
|
+
"accountId": "6c0b7cdc-aa0d-4999-86e3-e6f0a1d74a10"
|
|
48
|
+
},
|
|
49
|
+
"recentNewPullRequestHead": {
|
|
50
|
+
"server": {
|
|
51
|
+
"useHttp": false,
|
|
52
|
+
"host": "github.com",
|
|
53
|
+
"port": null,
|
|
54
|
+
"suffix": null
|
|
55
|
+
},
|
|
56
|
+
"owner": "minhdenthedev",
|
|
57
|
+
"repository": "dbgraph"
|
|
58
|
+
}
|
|
59
|
+
}</component>
|
|
60
|
+
<component name="ProjectColorInfo">{
|
|
61
|
+
"associatedIndex": 0,
|
|
62
|
+
"fromUser": false
|
|
63
|
+
}</component>
|
|
64
|
+
<component name="ProjectId" id="3IdnkFbc3mGdbjiFJYWIoYOgRXM" />
|
|
65
|
+
<component name="ProjectLevelVcsManager">
|
|
66
|
+
<ConfirmationsSetting value="2" id="Add" />
|
|
67
|
+
</component>
|
|
68
|
+
<component name="ProjectViewState">
|
|
69
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
70
|
+
<option name="showLibraryContents" value="true" />
|
|
71
|
+
</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"
|
|
92
|
+
}
|
|
93
|
+
}]]></component>
|
|
94
|
+
<component name="RunManager" selected="Python tests.Python tests in tests">
|
|
95
|
+
<configuration name="Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
96
|
+
<module name="dbgraph" />
|
|
97
|
+
<option name="ENV_FILES" value="" />
|
|
98
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
99
|
+
<option name="PARENT_ENVS" value="true" />
|
|
100
|
+
<option name="SDK_HOME" value="" />
|
|
101
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
102
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
103
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
104
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
105
|
+
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
106
|
+
<option name="RUN_TOOL" value="" />
|
|
107
|
+
<option name="_new_additionalArguments" value="""" />
|
|
108
|
+
<option name="_new_target" value=""tests.test_load_graph_sql.TestLoadGraphSQL.test_load"" />
|
|
109
|
+
<option name="_new_targetType" value=""PYTHON"" />
|
|
110
|
+
<method v="2" />
|
|
111
|
+
</configuration>
|
|
112
|
+
<configuration name="Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
113
|
+
<module name="dbgraph" />
|
|
114
|
+
<option name="ENV_FILES" value="" />
|
|
115
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
116
|
+
<option name="PARENT_ENVS" value="true" />
|
|
117
|
+
<option name="SDK_HOME" value="" />
|
|
118
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
119
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
120
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
121
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
122
|
+
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
123
|
+
<option name="RUN_TOOL" value="" />
|
|
124
|
+
<option name="_new_additionalArguments" value="""" />
|
|
125
|
+
<option name="_new_target" value=""tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph"" />
|
|
126
|
+
<option name="_new_targetType" value=""PYTHON"" />
|
|
127
|
+
<method v="2" />
|
|
128
|
+
</configuration>
|
|
129
|
+
<configuration name="Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
130
|
+
<module name="dbgraph" />
|
|
131
|
+
<option name="ENV_FILES" value="" />
|
|
132
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
133
|
+
<option name="PARENT_ENVS" value="true" />
|
|
134
|
+
<option name="SDK_HOME" value="" />
|
|
135
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
136
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
137
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
138
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
139
|
+
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
140
|
+
<option name="RUN_TOOL" value="" />
|
|
141
|
+
<option name="_new_additionalArguments" value="""" />
|
|
142
|
+
<option name="_new_target" value=""tests.test_sql_graph_persistent.TestSQLGraphPersistent"" />
|
|
143
|
+
<option name="_new_targetType" value=""PYTHON"" />
|
|
144
|
+
<method v="2" />
|
|
145
|
+
</configuration>
|
|
146
|
+
<configuration name="Python tests in test_load_graph_sql.py" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
147
|
+
<module name="dbgraph" />
|
|
148
|
+
<option name="ENV_FILES" value="" />
|
|
149
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
150
|
+
<option name="PARENT_ENVS" value="true" />
|
|
151
|
+
<option name="SDK_HOME" value="" />
|
|
152
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
153
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
154
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
155
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
156
|
+
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
157
|
+
<option name="RUN_TOOL" value="" />
|
|
158
|
+
<option name="_new_additionalArguments" value="""" />
|
|
159
|
+
<option name="_new_target" value=""$PROJECT_DIR$/tests/test_load_graph_sql.py"" />
|
|
160
|
+
<option name="_new_targetType" value=""PATH"" />
|
|
161
|
+
<method v="2" />
|
|
162
|
+
</configuration>
|
|
163
|
+
<configuration name="Python tests in tests" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
164
|
+
<module name="dbgraph" />
|
|
165
|
+
<option name="ENV_FILES" value="" />
|
|
166
|
+
<option name="INTERPRETER_OPTIONS" value="" />
|
|
167
|
+
<option name="PARENT_ENVS" value="true" />
|
|
168
|
+
<option name="SDK_HOME" value="" />
|
|
169
|
+
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/tests" />
|
|
170
|
+
<option name="IS_MODULE_SDK" value="true" />
|
|
171
|
+
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
172
|
+
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
173
|
+
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
174
|
+
<option name="RUN_TOOL" value="" />
|
|
175
|
+
<option name="_new_additionalArguments" value="""" />
|
|
176
|
+
<option name="_new_target" value=""$PROJECT_DIR$/tests"" />
|
|
177
|
+
<option name="_new_targetType" value=""PATH"" />
|
|
178
|
+
<method v="2" />
|
|
179
|
+
</configuration>
|
|
180
|
+
<recent_temporary>
|
|
181
|
+
<list>
|
|
182
|
+
<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" />
|
|
186
|
+
<item itemvalue="Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph" />
|
|
187
|
+
</list>
|
|
188
|
+
</recent_temporary>
|
|
189
|
+
</component>
|
|
190
|
+
<component name="SharedIndexes">
|
|
191
|
+
<attachedChunks>
|
|
192
|
+
<set>
|
|
193
|
+
<option value="bundled-python-sdk-821f704e66d9-5bd6d13a2a75-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-262.9437.214" />
|
|
194
|
+
</set>
|
|
195
|
+
</attachedChunks>
|
|
196
|
+
</component>
|
|
197
|
+
<component name="TaskManager">
|
|
198
|
+
<task active="true" id="Default" summary="Default task">
|
|
199
|
+
<changelist id="263a96da-9a82-40fd-89b2-ba71dd2c194d" name="Changes" comment="" />
|
|
200
|
+
<created>1788103453676</created>
|
|
201
|
+
<option name="number" value="Default" />
|
|
202
|
+
<option name="presentableId" value="Default" />
|
|
203
|
+
<updated>1788103453676</updated>
|
|
204
|
+
</task>
|
|
205
|
+
<task id="LOCAL-00001" summary="update packaging">
|
|
206
|
+
<option name="closed" value="true" />
|
|
207
|
+
<created>1788163967330</created>
|
|
208
|
+
<option name="number" value="00001" />
|
|
209
|
+
<option name="presentableId" value="LOCAL-00001" />
|
|
210
|
+
<option name="project" value="LOCAL" />
|
|
211
|
+
<updated>1788163967330</updated>
|
|
212
|
+
</task>
|
|
213
|
+
<task id="LOCAL-00002" summary="update packaging">
|
|
214
|
+
<option name="closed" value="true" />
|
|
215
|
+
<created>1788399865892</created>
|
|
216
|
+
<option name="number" value="00002" />
|
|
217
|
+
<option name="presentableId" value="LOCAL-00002" />
|
|
218
|
+
<option name="project" value="LOCAL" />
|
|
219
|
+
<updated>1788399865892</updated>
|
|
220
|
+
</task>
|
|
221
|
+
<task id="LOCAL-00003" summary="fix bugs in builder">
|
|
222
|
+
<option name="closed" value="true" />
|
|
223
|
+
<created>1788407330419</created>
|
|
224
|
+
<option name="number" value="00003" />
|
|
225
|
+
<option name="presentableId" value="LOCAL-00003" />
|
|
226
|
+
<option name="project" value="LOCAL" />
|
|
227
|
+
<updated>1788407330419</updated>
|
|
228
|
+
</task>
|
|
229
|
+
<option name="localTasksCounter" value="4" />
|
|
230
|
+
<servers />
|
|
231
|
+
</component>
|
|
232
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
233
|
+
<option name="version" value="3" />
|
|
234
|
+
</component>
|
|
235
|
+
<component name="Vcs.Log.Tabs.Properties">
|
|
236
|
+
<option name="TAB_STATES">
|
|
237
|
+
<map>
|
|
238
|
+
<entry key="MAIN">
|
|
239
|
+
<value>
|
|
240
|
+
<State />
|
|
241
|
+
</value>
|
|
242
|
+
</entry>
|
|
243
|
+
</map>
|
|
244
|
+
</option>
|
|
245
|
+
</component>
|
|
246
|
+
<component name="VcsManagerConfiguration">
|
|
247
|
+
<MESSAGE value="update packaging" />
|
|
248
|
+
<MESSAGE value="fix bugs in builder" />
|
|
249
|
+
<option name="LAST_COMMIT_MESSAGE" value="fix bugs in builder" />
|
|
250
|
+
</component>
|
|
251
|
+
<component name="XDebuggerManager">
|
|
252
|
+
<breakpoint-manager>
|
|
253
|
+
<breakpoints>
|
|
254
|
+
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
|
255
|
+
<url>file://$PROJECT_DIR$/dbgraph/persistent/sql_graph_persistent.py</url>
|
|
256
|
+
<line>330</line>
|
|
257
|
+
<option name="timeStamp" value="4" />
|
|
258
|
+
</line-breakpoint>
|
|
259
|
+
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
|
260
|
+
<url>file://$PROJECT_DIR$/dbgraph/persistent/sql_graph_persistent.py</url>
|
|
261
|
+
<line>351</line>
|
|
262
|
+
<option name="timeStamp" value="5" />
|
|
263
|
+
</line-breakpoint>
|
|
264
|
+
</breakpoints>
|
|
265
|
+
</breakpoint-manager>
|
|
266
|
+
</component>
|
|
267
|
+
</project>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: dbgraph
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: dbgraph is a database profiling tool which model the database as a graph
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
|
-
Requires-Dist: bm25s
|
|
6
|
+
Requires-Dist: bm25s>=0.3.9
|
|
7
7
|
Requires-Dist: build>=1.6.0
|
|
8
8
|
Requires-Dist: grip>=4.6.2
|
|
9
9
|
Requires-Dist: langchain-openai>=1.6.0
|
|
Binary file
|
|
@@ -13,7 +13,22 @@ from sqlalchemy import (
|
|
|
13
13
|
func,
|
|
14
14
|
inspect,
|
|
15
15
|
select,
|
|
16
|
+
SmallInteger,
|
|
17
|
+
Integer,
|
|
18
|
+
BigInteger,
|
|
19
|
+
Float,
|
|
20
|
+
DECIMAL,
|
|
21
|
+
Text,
|
|
22
|
+
Unicode,
|
|
23
|
+
UnicodeText,
|
|
24
|
+
CHAR,
|
|
25
|
+
NCHAR,
|
|
26
|
+
BLOB,
|
|
27
|
+
DATE,
|
|
28
|
+
DATETIME,
|
|
29
|
+
distinct,
|
|
16
30
|
)
|
|
31
|
+
from sqlalchemy.orm import Session
|
|
17
32
|
|
|
18
33
|
from dbgraph.builder.graph_builder import GraphBuilder
|
|
19
34
|
from dbgraph.entity.aspect import (
|
|
@@ -24,6 +39,7 @@ from dbgraph.entity.aspect import (
|
|
|
24
39
|
RNumericalStatistics,
|
|
25
40
|
RTableSchemaAspect,
|
|
26
41
|
RTableStatisticsAspect,
|
|
42
|
+
RTemporalStatistics,
|
|
27
43
|
)
|
|
28
44
|
from dbgraph.entity.asset import Asset
|
|
29
45
|
from dbgraph.entity.asset_type import AssetType
|
|
@@ -97,21 +113,40 @@ class SQLGraphBuilder(GraphBuilder):
|
|
|
97
113
|
value_counts = {str(row[0]): int(row[1]) for row in rows}
|
|
98
114
|
return RCategoricalStatistics(value_counts)
|
|
99
115
|
|
|
116
|
+
def _get_temp_aspect(self, col: Column) -> RTemporalStatistics:
|
|
117
|
+
min_max_nunique_stmt = select(
|
|
118
|
+
func.min(col), func.max(col), func.count(distinct(col))
|
|
119
|
+
)
|
|
120
|
+
mode_stmt = select(col).group_by(col).order_by(func.count(col).desc()).limit(1)
|
|
121
|
+
with Session(self.engine) as session:
|
|
122
|
+
min_time, max_time, nunique = session.execute(min_max_nunique_stmt).one()
|
|
123
|
+
mode = session.execute(mode_stmt).scalar()
|
|
124
|
+
return RTemporalStatistics(min_time, max_time, mode, nunique)
|
|
125
|
+
|
|
100
126
|
def _get_stats_aspect(self, col: Column) -> RColumnStatisticsAspect:
|
|
101
127
|
non_null_count, null_count = self._get_null_info(col)
|
|
102
|
-
|
|
128
|
+
num_aspect = None
|
|
129
|
+
cat_aspect = None
|
|
130
|
+
temp_aspect = None
|
|
131
|
+
if isinstance(
|
|
132
|
+
col.type, (Numeric, Integer, SmallInteger, BigInteger, Float, DECIMAL)
|
|
133
|
+
):
|
|
103
134
|
num_aspect = self._get_numerical_stats_aspect(col)
|
|
104
|
-
|
|
105
|
-
elif isinstance(col.type, String):
|
|
106
|
-
num_aspect = None
|
|
135
|
+
elif isinstance(col.type, (String, Text, Unicode, UnicodeText, CHAR, NCHAR)):
|
|
107
136
|
cat_aspect = self._get_cat_stats_aspect(col)
|
|
137
|
+
elif isinstance(col.type, (DATE, DATETIME)):
|
|
138
|
+
temp_aspect = self._get_temp_aspect(col)
|
|
139
|
+
elif isinstance(col.type, (BLOB,)):
|
|
140
|
+
pass
|
|
108
141
|
else:
|
|
109
|
-
|
|
110
|
-
|
|
142
|
+
raise NotImplementedError(
|
|
143
|
+
f"Only support Numeric, String, Date, and BLOB. Got {col.type} for {col.name}"
|
|
144
|
+
)
|
|
111
145
|
return RColumnStatisticsAspect(
|
|
112
146
|
name=f"{col.name}_column_stats",
|
|
113
147
|
numerical_stats=num_aspect,
|
|
114
148
|
categorical_stats=cat_aspect,
|
|
149
|
+
temporal_stats=temp_aspect,
|
|
115
150
|
non_null_count=non_null_count,
|
|
116
151
|
null_count=null_count,
|
|
117
152
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
+
from datetime import datetime, timedelta
|
|
2
3
|
from enum import StrEnum
|
|
3
4
|
|
|
4
5
|
|
|
@@ -103,6 +104,16 @@ class RCategoricalStatistics:
|
|
|
103
104
|
value_counts: dict[str, int]
|
|
104
105
|
|
|
105
106
|
|
|
107
|
+
@dataclass
|
|
108
|
+
class RTemporalStatistics:
|
|
109
|
+
"""Statistics for temporal columns"""
|
|
110
|
+
|
|
111
|
+
min_time: datetime | None = None
|
|
112
|
+
max_time: datetime | None = None
|
|
113
|
+
mode_time: datetime | None = None
|
|
114
|
+
num_uniques: int | None = None
|
|
115
|
+
|
|
116
|
+
|
|
106
117
|
@dataclass
|
|
107
118
|
class RColumnStatisticsAspect(Aspect):
|
|
108
119
|
"""Group of properties relevant to RDB's column statistics
|
|
@@ -118,6 +129,7 @@ class RColumnStatisticsAspect(Aspect):
|
|
|
118
129
|
null_count: int
|
|
119
130
|
numerical_stats: RNumericalStatistics | None = None
|
|
120
131
|
categorical_stats: RCategoricalStatistics | None = None
|
|
132
|
+
temporal_stats: RTemporalStatistics | None = None
|
|
121
133
|
|
|
122
134
|
|
|
123
135
|
class FKBehavior(StrEnum):
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import json
|
|
3
|
+
from typing import Any, Callable
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DateTimeEncoder(json.JSONEncoder):
|
|
7
|
+
"""Custom encoder for datetime"""
|
|
8
|
+
|
|
9
|
+
def default(self, o: Any) -> Any:
|
|
10
|
+
if isinstance(o, (datetime.date, datetime.datetime)):
|
|
11
|
+
return o.isoformat()
|
|
12
|
+
return super().default(o)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def datetime_parser(obj):
|
|
16
|
+
for key, value in obj.items():
|
|
17
|
+
if isinstance(value, str):
|
|
18
|
+
try:
|
|
19
|
+
# try parsing ISO format
|
|
20
|
+
obj[key] = datetime.datetime.fromisoformat(value)
|
|
21
|
+
except ValueError:
|
|
22
|
+
try:
|
|
23
|
+
# if there is only date
|
|
24
|
+
obj[key] = datetime.date.fromisoformat(value)
|
|
25
|
+
except ValueError:
|
|
26
|
+
pass
|
|
27
|
+
return obj
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class DateTimeDecoder(json.JSONDecoder):
|
|
31
|
+
"""Custom decoder for datetime"""
|
|
32
|
+
|
|
33
|
+
def __init__(self, *args, **kwargs):
|
|
34
|
+
super().__init__(object_hook=datetime_parser, *args, **kwargs)
|
|
@@ -181,8 +181,8 @@ class AssetAspectModel(Base):
|
|
|
181
181
|
nullable=False,
|
|
182
182
|
)
|
|
183
183
|
|
|
184
|
-
json_aspect: Mapped[
|
|
185
|
-
|
|
184
|
+
json_aspect: Mapped[str] = mapped_column(
|
|
185
|
+
Text,
|
|
186
186
|
nullable=False,
|
|
187
187
|
)
|
|
188
188
|
|
|
@@ -212,8 +212,8 @@ class LinkAspectModel(Base):
|
|
|
212
212
|
nullable=False,
|
|
213
213
|
)
|
|
214
214
|
|
|
215
|
-
json_aspect: Mapped[
|
|
216
|
-
|
|
215
|
+
json_aspect: Mapped[str] = mapped_column(
|
|
216
|
+
Text,
|
|
217
217
|
nullable=False,
|
|
218
218
|
)
|
|
219
219
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from dataclasses import asdict, dataclass
|
|
2
3
|
|
|
3
4
|
from sqlalchemy import create_engine, delete, select, update
|
|
@@ -13,6 +14,7 @@ from dbgraph.entity.aspect import (
|
|
|
13
14
|
RTableSchemaAspect,
|
|
14
15
|
RTableStatisticsAspect,
|
|
15
16
|
SemanticAspect,
|
|
17
|
+
RTemporalStatistics,
|
|
16
18
|
)
|
|
17
19
|
from dbgraph.entity.asset import Asset
|
|
18
20
|
from dbgraph.entity.asset_type import AssetType
|
|
@@ -20,6 +22,7 @@ from dbgraph.entity.dbgraph import DatabaseGraph
|
|
|
20
22
|
from dbgraph.entity.link import Link
|
|
21
23
|
from dbgraph.entity.link_type import LinkType
|
|
22
24
|
from dbgraph.persistent.graph_persistent import GraphPersistent
|
|
25
|
+
from dbgraph.persistent.json_utils import DateTimeEncoder, DateTimeDecoder
|
|
23
26
|
from dbgraph.persistent.models import (
|
|
24
27
|
AssetAspectModel,
|
|
25
28
|
AssetModel,
|
|
@@ -69,7 +72,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
69
72
|
asset_id=asset.asset_id,
|
|
70
73
|
name=aspect.name,
|
|
71
74
|
type=aspect_type,
|
|
72
|
-
json_aspect=asdict(aspect),
|
|
75
|
+
json_aspect=json.dumps(asdict(aspect), cls=DateTimeEncoder),
|
|
73
76
|
)
|
|
74
77
|
aspects.append(aspect)
|
|
75
78
|
with Session(self.engine) as session:
|
|
@@ -110,7 +113,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
110
113
|
link_id=link.link_id,
|
|
111
114
|
name=aspect.name,
|
|
112
115
|
type=aspect_type,
|
|
113
|
-
json_aspect=asdict(aspect),
|
|
116
|
+
json_aspect=json.dumps(asdict(aspect), cls=DateTimeEncoder),
|
|
114
117
|
)
|
|
115
118
|
aspects.append(link_aspect)
|
|
116
119
|
with Session(self.engine) as session:
|
|
@@ -201,7 +204,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
201
204
|
name=aspect.name,
|
|
202
205
|
type=aspect_type,
|
|
203
206
|
asset_id=asset_id,
|
|
204
|
-
json_aspect=asdict(aspect),
|
|
207
|
+
json_aspect=json.dumps(asdict(aspect), cls=DateTimeEncoder),
|
|
205
208
|
)
|
|
206
209
|
for aspect_type, aspect in aspects.items()
|
|
207
210
|
]
|
|
@@ -216,7 +219,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
216
219
|
name=aspect.name,
|
|
217
220
|
type=aspect_type,
|
|
218
221
|
link_id=link_id,
|
|
219
|
-
json_aspect=asdict(aspect),
|
|
222
|
+
json_aspect=json.dumps(asdict(aspect), cls=DateTimeEncoder),
|
|
220
223
|
)
|
|
221
224
|
for aspect_type, aspect in aspects.items()
|
|
222
225
|
]
|
|
@@ -228,7 +231,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
228
231
|
self, model: AssetAspectModel, asset_type: AssetType
|
|
229
232
|
) -> Aspect:
|
|
230
233
|
"""Turn SQL Alchemy model to Aspect"""
|
|
231
|
-
json_aspect = model.json_aspect
|
|
234
|
+
json_aspect = json.loads(model.json_aspect, cls=DateTimeDecoder)
|
|
232
235
|
match model.type:
|
|
233
236
|
case "schema_properties":
|
|
234
237
|
if asset_type == AssetType.RTABLE:
|
|
@@ -241,6 +244,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
241
244
|
if asset_type == AssetType.RTABLE:
|
|
242
245
|
aspect = RTableStatisticsAspect(**json_aspect)
|
|
243
246
|
elif asset_type == AssetType.RCOLUMN:
|
|
247
|
+
numerical_aspect = categorical_aspect = temp_aspect = None
|
|
244
248
|
if json_aspect["numerical_stats"] is not None:
|
|
245
249
|
numerical_aspect = RNumericalStatistics(
|
|
246
250
|
**json_aspect["numerical_stats"]
|
|
@@ -251,9 +255,9 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
251
255
|
**json_aspect["categorical_stats"]
|
|
252
256
|
)
|
|
253
257
|
numerical_aspect = None
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
"
|
|
258
|
+
elif json_aspect["temporal_stats"] is not None:
|
|
259
|
+
temp_aspect = RTemporalStatistics(
|
|
260
|
+
**json_aspect["temporal_stats"]
|
|
257
261
|
)
|
|
258
262
|
aspect = RColumnStatisticsAspect(
|
|
259
263
|
name=json_aspect["name"],
|
|
@@ -261,6 +265,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
261
265
|
null_count=json_aspect["null_count"],
|
|
262
266
|
categorical_stats=categorical_aspect,
|
|
263
267
|
numerical_stats=numerical_aspect,
|
|
268
|
+
temporal_stats=temp_aspect,
|
|
264
269
|
)
|
|
265
270
|
else:
|
|
266
271
|
raise NotImplementedError()
|
|
@@ -289,7 +294,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
289
294
|
|
|
290
295
|
def _parse_link_aspect_model(self, model: LinkAspectModel) -> Aspect:
|
|
291
296
|
"""Turn SQL Alchemy model to Link Aspect"""
|
|
292
|
-
json_aspect = model.json_aspect
|
|
297
|
+
json_aspect = json.loads(model.json_aspect, cls=DateTimeDecoder)
|
|
293
298
|
match model.type:
|
|
294
299
|
case "foreign_key_properties":
|
|
295
300
|
aspect = RForeignKeyAspect(**json_aspect)
|
|
@@ -315,7 +320,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
315
320
|
with Session(self.engine) as session:
|
|
316
321
|
models = session.scalars(
|
|
317
322
|
select(AssetModel).where(AssetModel.graph_id == graph_id)
|
|
318
|
-
)
|
|
323
|
+
).all()
|
|
319
324
|
assets = []
|
|
320
325
|
for model in models:
|
|
321
326
|
aspects = {}
|
|
@@ -336,7 +341,7 @@ class SQLGraphPersistent(GraphPersistent):
|
|
|
336
341
|
with Session(self.engine) as session:
|
|
337
342
|
models = session.scalars(
|
|
338
343
|
select(LinkModel).where(LinkModel.graph_id == graph_id)
|
|
339
|
-
)
|
|
344
|
+
).all()
|
|
340
345
|
links = []
|
|
341
346
|
for model in models:
|
|
342
347
|
aspects = {}
|
|
@@ -4,12 +4,12 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dbgraph"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.1"
|
|
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"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"bm25s
|
|
12
|
+
"bm25s>=0.3.9",
|
|
13
13
|
"build>=1.6.0",
|
|
14
14
|
"grip>=4.6.2",
|
|
15
15
|
"langchain>=1.3.16",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
from dbgraph import SQLGraphPersistent, SQLGraphBuilder
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class TestLoadGraphSQL(unittest.TestCase):
|
|
7
|
+
def setUp(self) -> None:
|
|
8
|
+
self.graph_builder = SQLGraphBuilder("sqlite:///data/northwind.db")
|
|
9
|
+
self.persistent = SQLGraphPersistent("sqlite:///:memory:")
|
|
10
|
+
|
|
11
|
+
def test_load(self):
|
|
12
|
+
target_graph_id = "test-graph"
|
|
13
|
+
target_graph = self.graph_builder.build_graph()
|
|
14
|
+
self.persistent.save_graph(target_graph, target_graph_id)
|
|
15
|
+
graph = self.persistent.load_graph(target_graph_id)
|
|
16
|
+
self.assertEqual(len(target_graph.assets), len(graph.assets))
|
|
17
|
+
self.assertEqual(len(target_graph.links), len(graph.links))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == "__main__":
|
|
21
|
+
unittest.main()
|
|
@@ -14,7 +14,7 @@ def get_kv_memory():
|
|
|
14
14
|
|
|
15
15
|
class TestSQLGraphBuilder(unittest.TestCase):
|
|
16
16
|
def setUp(self) -> None:
|
|
17
|
-
self.graph_builder = SQLGraphBuilder("
|
|
17
|
+
self.graph_builder = SQLGraphBuilder("sqlite:///data/northwind.db")
|
|
18
18
|
|
|
19
19
|
def test_build_graph(self):
|
|
20
20
|
from time import perf_counter_ns
|
|
@@ -22,7 +22,7 @@ from dbgraph.persistent.sql_graph_persistent import SQLGraphPersistent
|
|
|
22
22
|
|
|
23
23
|
class TestSQLGraphPersistent(unittest.TestCase):
|
|
24
24
|
def setUp(self) -> None:
|
|
25
|
-
self.persistent = SQLGraphPersistent("sqlite
|
|
25
|
+
self.persistent = SQLGraphPersistent("sqlite:///:memory:")
|
|
26
26
|
assets = [
|
|
27
27
|
Asset(
|
|
28
28
|
asset_id="1",
|
|
@@ -298,10 +298,6 @@ class TestSQLGraphPersistent(unittest.TestCase):
|
|
|
298
298
|
self.graph_name = "graph-1"
|
|
299
299
|
self.persistent.create_graph(self.graph_id, self.graph_name)
|
|
300
300
|
|
|
301
|
-
def tearDown(self) -> None:
|
|
302
|
-
self.persistent.delete_graph(self.graph_id)
|
|
303
|
-
os.remove("data/graph.db")
|
|
304
|
-
|
|
305
301
|
def test_asset(self):
|
|
306
302
|
target_asset = self.graph.get_asset("1")
|
|
307
303
|
self.persistent.insert_asset(target_asset, self.graph_id)
|
|
@@ -440,6 +436,11 @@ class TestSQLGraphPersistent(unittest.TestCase):
|
|
|
440
436
|
graph = self.persistent.load_graph(self.graph_id)
|
|
441
437
|
self.assertEqual(graph, self.graph)
|
|
442
438
|
|
|
439
|
+
def test_save_graph(self):
|
|
440
|
+
self.persistent.save_graph(self.graph, self.graph_id)
|
|
441
|
+
graph = self.persistent.load_graph(self.graph_id)
|
|
442
|
+
self.assertEqual(self.graph, graph)
|
|
443
|
+
|
|
443
444
|
def test_get_graph_info(self):
|
|
444
445
|
graph_info = self.persistent.get_graph_info("1")
|
|
445
446
|
self.assertEqual(graph_info[1], "graph-1")
|
|
@@ -284,7 +284,7 @@ wheels = [
|
|
|
284
284
|
|
|
285
285
|
[[package]]
|
|
286
286
|
name = "dbgraph"
|
|
287
|
-
version = "0.1
|
|
287
|
+
version = "0.2.1"
|
|
288
288
|
source = { editable = "." }
|
|
289
289
|
dependencies = [
|
|
290
290
|
{ name = "bm25s" },
|
|
@@ -312,7 +312,7 @@ dependencies = [
|
|
|
312
312
|
|
|
313
313
|
[package.metadata]
|
|
314
314
|
requires-dist = [
|
|
315
|
-
{ name = "bm25s",
|
|
315
|
+
{ name = "bm25s", specifier = ">=0.3.9" },
|
|
316
316
|
{ name = "build", specifier = ">=1.6.0" },
|
|
317
317
|
{ name = "grip", specifier = ">=4.6.2" },
|
|
318
318
|
{ name = "langchain", specifier = ">=1.3.16" },
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="AutoImportSettings">
|
|
4
|
-
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
|
-
</component>
|
|
6
|
-
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="263a96da-9a82-40fd-89b2-ba71dd2c194d" name="Changes" comment="update packaging">
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/uv.lock" beforeDir="false" afterPath="$PROJECT_DIR$/uv.lock" afterDir="false" />
|
|
10
|
-
</list>
|
|
11
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
12
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
13
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
14
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
15
|
-
</component>
|
|
16
|
-
<component name="FileTemplateManagerImpl">
|
|
17
|
-
<option name="RECENT_TEMPLATES">
|
|
18
|
-
<list>
|
|
19
|
-
<option value="Python Script" />
|
|
20
|
-
</list>
|
|
21
|
-
</option>
|
|
22
|
-
</component>
|
|
23
|
-
<component name="Git.Settings">
|
|
24
|
-
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
|
25
|
-
<map>
|
|
26
|
-
<entry key="$PROJECT_DIR$" value="packaging" />
|
|
27
|
-
</map>
|
|
28
|
-
</option>
|
|
29
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
30
|
-
</component>
|
|
31
|
-
<component name="GitHubPullRequestSearchHistory">{
|
|
32
|
-
"lastFilter": {
|
|
33
|
-
"state": "OPEN",
|
|
34
|
-
"assignee": "minhdenthedev"
|
|
35
|
-
}
|
|
36
|
-
}</component>
|
|
37
|
-
<component name="GithubPullRequestsUISettings">{
|
|
38
|
-
"selectedUrlAndAccountId": {
|
|
39
|
-
"url": "https://github.com/minhdenthedev/dbgraph.git",
|
|
40
|
-
"accountId": "6c0b7cdc-aa0d-4999-86e3-e6f0a1d74a10"
|
|
41
|
-
},
|
|
42
|
-
"recentNewPullRequestHead": {
|
|
43
|
-
"server": {
|
|
44
|
-
"useHttp": false,
|
|
45
|
-
"host": "github.com",
|
|
46
|
-
"port": null,
|
|
47
|
-
"suffix": null
|
|
48
|
-
},
|
|
49
|
-
"owner": "minhdenthedev",
|
|
50
|
-
"repository": "dbgraph"
|
|
51
|
-
}
|
|
52
|
-
}</component>
|
|
53
|
-
<component name="ProjectColorInfo">{
|
|
54
|
-
"associatedIndex": 0,
|
|
55
|
-
"fromUser": false
|
|
56
|
-
}</component>
|
|
57
|
-
<component name="ProjectId" id="3IdnkFbc3mGdbjiFJYWIoYOgRXM" />
|
|
58
|
-
<component name="ProjectLevelVcsManager">
|
|
59
|
-
<ConfirmationsSetting value="2" id="Add" />
|
|
60
|
-
</component>
|
|
61
|
-
<component name="ProjectViewState">
|
|
62
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
|
63
|
-
<option name="showLibraryContents" value="true" />
|
|
64
|
-
</component>
|
|
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 in tests.executor": "Run",
|
|
71
|
-
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
72
|
-
"RunOnceActivity.git.unshallow": "true",
|
|
73
|
-
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
|
74
|
-
"codeWithMe.voiceChat.enabledByDefault": "false",
|
|
75
|
-
"git-widget-placeholder": "main",
|
|
76
|
-
"ignore.virus.scanning.warn.message": "true",
|
|
77
|
-
"nodejs_package_manager_path": "npm"
|
|
78
|
-
}
|
|
79
|
-
}</component>
|
|
80
|
-
<component name="RunManager" selected="Python tests.Python tests for tests.test_dbgraph.TestDBGraph">
|
|
81
|
-
<configuration name="Python tests for tests.test_dbgraph.TestDBGraph" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
82
|
-
<module name="dbgraph" />
|
|
83
|
-
<option name="ENV_FILES" value="" />
|
|
84
|
-
<option name="INTERPRETER_OPTIONS" value="" />
|
|
85
|
-
<option name="PARENT_ENVS" value="true" />
|
|
86
|
-
<option name="SDK_HOME" value="" />
|
|
87
|
-
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
|
88
|
-
<option name="IS_MODULE_SDK" value="true" />
|
|
89
|
-
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
90
|
-
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
91
|
-
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
92
|
-
<option name="RUN_TOOL" value="" />
|
|
93
|
-
<option name="_new_additionalArguments" value="""" />
|
|
94
|
-
<option name="_new_target" value=""tests.test_dbgraph.TestDBGraph"" />
|
|
95
|
-
<option name="_new_targetType" value=""PYTHON"" />
|
|
96
|
-
<method v="2" />
|
|
97
|
-
</configuration>
|
|
98
|
-
<configuration name="Python tests in tests" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
|
|
99
|
-
<module name="dbgraph" />
|
|
100
|
-
<option name="ENV_FILES" value="" />
|
|
101
|
-
<option name="INTERPRETER_OPTIONS" value="" />
|
|
102
|
-
<option name="PARENT_ENVS" value="true" />
|
|
103
|
-
<option name="SDK_HOME" value="" />
|
|
104
|
-
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/tests" />
|
|
105
|
-
<option name="IS_MODULE_SDK" value="true" />
|
|
106
|
-
<option name="ADD_CONTENT_ROOTS" value="true" />
|
|
107
|
-
<option name="ADD_SOURCE_ROOTS" value="true" />
|
|
108
|
-
<option name="DEBUG_JUST_MY_CODE" value="false" />
|
|
109
|
-
<option name="RUN_TOOL" value="" />
|
|
110
|
-
<option name="_new_additionalArguments" value="""" />
|
|
111
|
-
<option name="_new_target" value=""$PROJECT_DIR$/tests"" />
|
|
112
|
-
<option name="_new_targetType" value=""PATH"" />
|
|
113
|
-
<method v="2" />
|
|
114
|
-
</configuration>
|
|
115
|
-
<recent_temporary>
|
|
116
|
-
<list>
|
|
117
|
-
<item itemvalue="Python tests.Python tests in tests" />
|
|
118
|
-
<item itemvalue="Python tests.Python tests for tests.test_dbgraph.TestDBGraph" />
|
|
119
|
-
<item itemvalue="Python tests.Python tests for tests.test_dbgraph.TestDBGraph" />
|
|
120
|
-
<item itemvalue="Python tests.Python tests in tests" />
|
|
121
|
-
</list>
|
|
122
|
-
</recent_temporary>
|
|
123
|
-
</component>
|
|
124
|
-
<component name="SharedIndexes">
|
|
125
|
-
<attachedChunks>
|
|
126
|
-
<set>
|
|
127
|
-
<option value="bundled-python-sdk-821f704e66d9-5bd6d13a2a75-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-262.9437.214" />
|
|
128
|
-
</set>
|
|
129
|
-
</attachedChunks>
|
|
130
|
-
</component>
|
|
131
|
-
<component name="TaskManager">
|
|
132
|
-
<task active="true" id="Default" summary="Default task">
|
|
133
|
-
<changelist id="263a96da-9a82-40fd-89b2-ba71dd2c194d" name="Changes" comment="" />
|
|
134
|
-
<created>1788103453676</created>
|
|
135
|
-
<option name="number" value="Default" />
|
|
136
|
-
<option name="presentableId" value="Default" />
|
|
137
|
-
<updated>1788103453676</updated>
|
|
138
|
-
</task>
|
|
139
|
-
<task id="LOCAL-00001" summary="update packaging">
|
|
140
|
-
<option name="closed" value="true" />
|
|
141
|
-
<created>1788163967330</created>
|
|
142
|
-
<option name="number" value="00001" />
|
|
143
|
-
<option name="presentableId" value="LOCAL-00001" />
|
|
144
|
-
<option name="project" value="LOCAL" />
|
|
145
|
-
<updated>1788163967330</updated>
|
|
146
|
-
</task>
|
|
147
|
-
<option name="localTasksCounter" value="2" />
|
|
148
|
-
<servers />
|
|
149
|
-
</component>
|
|
150
|
-
<component name="TypeScriptGeneratedFilesManager">
|
|
151
|
-
<option name="version" value="3" />
|
|
152
|
-
</component>
|
|
153
|
-
<component name="Vcs.Log.Tabs.Properties">
|
|
154
|
-
<option name="TAB_STATES">
|
|
155
|
-
<map>
|
|
156
|
-
<entry key="MAIN">
|
|
157
|
-
<value>
|
|
158
|
-
<State />
|
|
159
|
-
</value>
|
|
160
|
-
</entry>
|
|
161
|
-
</map>
|
|
162
|
-
</option>
|
|
163
|
-
</component>
|
|
164
|
-
<component name="VcsManagerConfiguration">
|
|
165
|
-
<MESSAGE value="update packaging" />
|
|
166
|
-
<option name="LAST_COMMIT_MESSAGE" value="update packaging" />
|
|
167
|
-
</component>
|
|
168
|
-
</project>
|
|
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
|