dbgraph 0.2.5__tar.gz → 0.2.7__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 (86) hide show
  1. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/workspace.xml +26 -26
  2. {dbgraph-0.2.5 → dbgraph-0.2.7}/PKG-INFO +1 -1
  3. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/persistent/sql_graph_persistent.py +11 -4
  4. {dbgraph-0.2.5 → dbgraph-0.2.7}/pyproject.toml +1 -1
  5. {dbgraph-0.2.5 → dbgraph-0.2.7}/uv.lock +1 -1
  6. {dbgraph-0.2.5 → dbgraph-0.2.7}/.gitignore +0 -0
  7. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/.gitignore +0 -0
  8. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/dbgraph.iml +0 -0
  9. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  10. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/misc.xml +0 -0
  11. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/modules.xml +0 -0
  12. {dbgraph-0.2.5 → dbgraph-0.2.7}/.idea/vcs.xml +0 -0
  13. {dbgraph-0.2.5 → dbgraph-0.2.7}/.python-version +0 -0
  14. {dbgraph-0.2.5 → dbgraph-0.2.7}/README.md +0 -0
  15. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-desc.md +0 -0
  16. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-graph-import.db +0 -0
  17. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-graph-v2.json +0 -0
  18. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-graph-v4.json +0 -0
  19. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-graph.db +0 -0
  20. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-graph.json +0 -0
  21. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-graph.png +0 -0
  22. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/corpus.jsonl +0 -0
  23. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/corpus.mmindex.json +0 -0
  24. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/data.csc.index.npy +0 -0
  25. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/indices.csc.index.npy +0 -0
  26. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/indptr.csc.index.npy +0 -0
  27. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/params.index.json +0 -0
  28. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-index/vocab.index.json +0 -0
  29. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind-semantic-v5.json +0 -0
  30. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/northwind.db +0 -0
  31. {dbgraph-0.2.5 → dbgraph-0.2.7}/data/time-results.txt +0 -0
  32. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/__init__.py +0 -0
  33. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/application.py +0 -0
  34. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/builder/__init__.py +0 -0
  35. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/builder/graph_builder.py +0 -0
  36. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/builder/sql_graph_builder.py +0 -0
  37. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/descriptor/__init__.py +0 -0
  38. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/descriptor/graph_descriptor.py +0 -0
  39. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/descriptor/langchain_graph_descriptor.py +0 -0
  40. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/descriptor/prompt_templates.py +0 -0
  41. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/__init__.py +0 -0
  42. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/aspect.py +0 -0
  43. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/asset.py +0 -0
  44. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/asset_type.py +0 -0
  45. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/dbgraph.py +0 -0
  46. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/link.py +0 -0
  47. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/link_type.py +0 -0
  48. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/entity/rdbgraph.py +0 -0
  49. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/io/__init__.py +0 -0
  50. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/io/graph_loader.py +0 -0
  51. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/io/graph_writer.py +0 -0
  52. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/io/json_graph_loader.py +0 -0
  53. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/io/json_graph_writer.py +0 -0
  54. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/persistent/__init__.py +0 -0
  55. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/persistent/graph_persistent.py +0 -0
  56. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/persistent/json_utils.py +0 -0
  57. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/persistent/models.py +0 -0
  58. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/render/__init__.py +0 -0
  59. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/render/graph_renderer.py +0 -0
  60. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/render/markdown_renderer.py +0 -0
  61. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/search/__init__.py +0 -0
  62. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/search/bm25_search_engine.py +0 -0
  63. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/search/search_engine.py +0 -0
  64. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/utils/__init__.py +0 -0
  65. {dbgraph-0.2.5 → dbgraph-0.2.7}/dbgraph/utils/singleton.py +0 -0
  66. {dbgraph-0.2.5 → dbgraph-0.2.7}/diagrams/entity.png +0 -0
  67. {dbgraph-0.2.5 → dbgraph-0.2.7}/diagrams/entity.txt +0 -0
  68. {dbgraph-0.2.5 → dbgraph-0.2.7}/diagrams/usecase.png +0 -0
  69. {dbgraph-0.2.5 → dbgraph-0.2.7}/diagrams/usecase.txt +0 -0
  70. {dbgraph-0.2.5 → dbgraph-0.2.7}/docs/index.md +0 -0
  71. {dbgraph-0.2.5 → dbgraph-0.2.7}/docs/refs/aspect.md +0 -0
  72. {dbgraph-0.2.5 → dbgraph-0.2.7}/docs/refs/graph.md +0 -0
  73. {dbgraph-0.2.5 → dbgraph-0.2.7}/main.py +0 -0
  74. {dbgraph-0.2.5 → dbgraph-0.2.7}/mkdocs.yml +0 -0
  75. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/__init__.py +0 -0
  76. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_application.py +0 -0
  77. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_bm25s_search_engine.py +0 -0
  78. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_dbgraph.py +0 -0
  79. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_json_graph_loader.py +0 -0
  80. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_json_graph_writer.py +0 -0
  81. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_langchain_graph_descriptor.py +0 -0
  82. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_load_graph_sql.py +0 -0
  83. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_markdown_renderer.py +0 -0
  84. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_rdbgraph.py +0 -0
  85. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_sql_graph_builder.py +0 -0
  86. {dbgraph-0.2.5 → dbgraph-0.2.7}/tests/test_sql_graph_persistent.py +0 -0
@@ -71,32 +71,32 @@
71
71
  <option name="hideEmptyMiddlePackages" value="true" />
72
72
  <option name="showLibraryContents" value="true" />
73
73
  </component>
74
- <component name="PropertiesComponent"><![CDATA[{
75
- "keyToString": {
76
- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
77
- "ModuleVcsDetector.initialDetectionPerformed": "true",
78
- "Python tests.Python tests for tests.test_dbgraph.TestDBGraph.executor": "Run",
79
- "Python tests.Python tests for tests.test_json_graph_loader.TestJSONGraphLoader.test_get_neighbors_sub_graph.executor": "Run",
80
- "Python tests.Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load.executor": "Run",
81
- "Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.executor": "Run",
82
- "Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links.executor": "Run",
83
- "Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph.executor": "Run",
84
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.executor": "Run",
85
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_delete_graph.executor": "Run",
86
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_load_graph.executor": "Run",
87
- "Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_save_graph.executor": "Run",
88
- "Python tests.Python tests in test_load_graph_sql.py.executor": "Run",
89
- "Python tests.Python tests in tests.executor": "Run",
90
- "RunOnceActivity.ShowReadmeOnStart": "true",
91
- "RunOnceActivity.git.unshallow": "true",
92
- "RunOnceActivity.typescript.service.memoryLimit.init": "true",
93
- "codeWithMe.voiceChat.enabledByDefault": "false",
94
- "git-widget-placeholder": "main",
95
- "ignore.virus.scanning.warn.message": "true",
96
- "nodejs_package_manager_path": "npm",
97
- "settings.editor.selected.configurable": "editor.preferences.folding"
74
+ <component name="PropertiesComponent">{
75
+ &quot;keyToString&quot;: {
76
+ &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
77
+ &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
78
+ &quot;Python tests.Python tests for tests.test_dbgraph.TestDBGraph.executor&quot;: &quot;Run&quot;,
79
+ &quot;Python tests.Python tests for tests.test_json_graph_loader.TestJSONGraphLoader.test_get_neighbors_sub_graph.executor&quot;: &quot;Run&quot;,
80
+ &quot;Python tests.Python tests for tests.test_load_graph_sql.TestLoadGraphSQL.test_load.executor&quot;: &quot;Run&quot;,
81
+ &quot;Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.executor&quot;: &quot;Run&quot;,
82
+ &quot;Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test__build_links.executor&quot;: &quot;Run&quot;,
83
+ &quot;Python tests.Python tests for tests.test_sql_graph_builder.TestSQLGraphBuilder.test_build_graph.executor&quot;: &quot;Run&quot;,
84
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.executor&quot;: &quot;Run&quot;,
85
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_delete_graph.executor&quot;: &quot;Run&quot;,
86
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_load_graph.executor&quot;: &quot;Run&quot;,
87
+ &quot;Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_save_graph.executor&quot;: &quot;Run&quot;,
88
+ &quot;Python tests.Python tests in test_load_graph_sql.py.executor&quot;: &quot;Run&quot;,
89
+ &quot;Python tests.Python tests in tests.executor&quot;: &quot;Run&quot;,
90
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
91
+ &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
92
+ &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
93
+ &quot;codeWithMe.voiceChat.enabledByDefault&quot;: &quot;false&quot;,
94
+ &quot;git-widget-placeholder&quot;: &quot;main&quot;,
95
+ &quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
96
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
97
+ &quot;settings.editor.selected.configurable&quot;: &quot;editor.preferences.folding&quot;
98
98
  }
99
- }]]></component>
99
+ }</component>
100
100
  <component name="RunManager" selected="Python tests.Python tests for tests.test_sql_graph_persistent.TestSQLGraphPersistent.test_delete_graph">
101
101
  <configuration name="Python tests for tests.test_json_graph_loader.TestJSONGraphLoader.test_get_neighbors_sub_graph" type="tests" factoryName="Autodetect" temporary="true" nameIsGenerated="true">
102
102
  <module name="dbgraph" />
@@ -318,7 +318,7 @@
318
318
  <breakpoints>
319
319
  <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
320
320
  <url>file://$PROJECT_DIR$/dbgraph/persistent/sql_graph_persistent.py</url>
321
- <line>353</line>
321
+ <line>360</line>
322
322
  <option name="timeStamp" value="5" />
323
323
  </line-breakpoint>
324
324
  </breakpoints>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: dbgraph
3
- Version: 0.2.5
3
+ Version: 0.2.7
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
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  from dataclasses import asdict, dataclass
3
3
 
4
- from sqlalchemy import create_engine, delete, select, update
4
+ from sqlalchemy import create_engine, delete, select, update, event
5
5
  from sqlalchemy.orm import Session
6
6
 
7
7
  from dbgraph.entity.aspect import (
@@ -41,8 +41,17 @@ class SQLGraphPersistent(GraphPersistent):
41
41
 
42
42
  def __post_init__(self):
43
43
  self.engine = create_engine(self.db_uri)
44
+
45
+ @event.listens_for(self.engine, "connect")
46
+ def set_sqlite_pragma(dbapi_connection, connection_record):
47
+ if dbapi_connection.__class__.__module__.startswith("sqlite3"):
48
+ cursor = dbapi_connection.cursor()
49
+ cursor.execute("PRAGMA foreign_keys=ON")
50
+ cursor.close()
51
+
44
52
  Base.metadata.create_all(bind=self.engine)
45
53
 
54
+
46
55
  def create_graph(self, graph_id: str, graph_name: str):
47
56
  graph_model = GraphModel(graph_id=graph_id, name=graph_name, completed=False)
48
57
  with Session(self.engine) as session:
@@ -52,8 +61,6 @@ class SQLGraphPersistent(GraphPersistent):
52
61
  def delete_graph(self, graph_id: str):
53
62
  with Session(self.engine) as session:
54
63
  session.execute(delete(GraphModel).where(GraphModel.graph_id == graph_id))
55
- session.execute(delete(AssetModel).where(AssetModel.graph_id == graph_id))
56
- session.execute(delete(LinkModel).where(LinkModel.graph_id == graph_id))
57
64
  session.commit()
58
65
 
59
66
  def insert_assets(self, assets: list[Asset], graph_id: str):
@@ -370,7 +377,7 @@ class SQLGraphPersistent(GraphPersistent):
370
377
 
371
378
  def save_graph(self, graph: DatabaseGraph, graph_id: str):
372
379
  """Save the graph into database"""
373
-
380
+ self.create_graph(graph_id, graph_id)
374
381
  self.insert_assets(graph.assets, graph_id)
375
382
  self.insert_links(graph.links, graph_id)
376
383
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "dbgraph"
7
- version = "0.2.5"
7
+ version = "0.2.7"
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"
@@ -284,7 +284,7 @@ wheels = [
284
284
 
285
285
  [[package]]
286
286
  name = "dbgraph"
287
- version = "0.2.4"
287
+ version = "0.2.6"
288
288
  source = { editable = "." }
289
289
  dependencies = [
290
290
  { name = "bm25s" },
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