structured2graph 0.1.1__py3-none-any.whl
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.
- __init__.py +47 -0
- core/__init__.py +23 -0
- core/hygm/__init__.py +74 -0
- core/hygm/hygm.py +2351 -0
- core/hygm/models/__init__.py +82 -0
- core/hygm/models/graph_models.py +667 -0
- core/hygm/models/llm_models.py +229 -0
- core/hygm/models/operations.py +176 -0
- core/hygm/models/sources.py +68 -0
- core/hygm/models/user_operations.py +139 -0
- core/hygm/strategies/__init__.py +17 -0
- core/hygm/strategies/base.py +36 -0
- core/hygm/strategies/deterministic.py +262 -0
- core/hygm/strategies/llm.py +904 -0
- core/hygm/validation/__init__.py +38 -0
- core/hygm/validation/base.py +194 -0
- core/hygm/validation/graph_schema_validator.py +687 -0
- core/hygm/validation/memgraph_data_validator.py +991 -0
- core/migration_agent.py +1369 -0
- core/schema/spec.json +155 -0
- core/utils/meta_graph.py +108 -0
- database/__init__.py +36 -0
- database/adapters/__init__.py +11 -0
- database/adapters/memgraph.py +318 -0
- database/adapters/mysql.py +311 -0
- database/adapters/postgresql.py +335 -0
- database/analyzer.py +396 -0
- database/factory.py +219 -0
- database/models.py +209 -0
- main.py +518 -0
- query_generation/__init__.py +20 -0
- query_generation/cypher_generator.py +129 -0
- query_generation/schema_utilities.py +88 -0
- structured2graph-0.1.1.dist-info/METADATA +197 -0
- structured2graph-0.1.1.dist-info/RECORD +41 -0
- structured2graph-0.1.1.dist-info/WHEEL +4 -0
- structured2graph-0.1.1.dist-info/entry_points.txt +2 -0
- structured2graph-0.1.1.dist-info/licenses/LICENSE +21 -0
- utils/__init__.py +57 -0
- utils/config.py +235 -0
- utils/environment.py +404 -0
__init__.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SQL Database to Graph Migration Agent
|
|
3
|
+
|
|
4
|
+
This package provides intelligent database migration capabilities from SQL databases
|
|
5
|
+
to graph databases with LLM-powered graph modeling and analysis.
|
|
6
|
+
|
|
7
|
+
## Package Structure
|
|
8
|
+
|
|
9
|
+
- `core/` - Main migration orchestration and graph modeling (HyGM)
|
|
10
|
+
- `database/` - Database analysis and data interface layer
|
|
11
|
+
- `query_generation/` - Cypher query generation and schema utilities
|
|
12
|
+
- `utils/` - Configuration and environment utilities
|
|
13
|
+
- `examples/` - Usage examples and demonstrations
|
|
14
|
+
- `tests/` - Tests and troubleshooting tools
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
from agents.core import SQLToMemgraphAgent, HyGM
|
|
20
|
+
from agents.core.hygm import ModelingMode
|
|
21
|
+
from agents.utils import setup_and_validate_environment
|
|
22
|
+
|
|
23
|
+
# Setup environment
|
|
24
|
+
mysql_config, memgraph_config = setup_and_validate_environment()
|
|
25
|
+
|
|
26
|
+
# Create migration agent
|
|
27
|
+
agent = SQLToMemgraphAgent(modeling_mode=ModelingMode.AUTOMATIC)
|
|
28
|
+
|
|
29
|
+
# Run migration
|
|
30
|
+
result = agent.migrate(source_db_config, memgraph_config)
|
|
31
|
+
```
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
# Main exports
|
|
35
|
+
from .core import SQLToMemgraphAgent, HyGM
|
|
36
|
+
from .database import DatabaseAnalyzerFactory
|
|
37
|
+
from .query_generation import CypherGenerator, SchemaUtilities
|
|
38
|
+
|
|
39
|
+
__version__ = "0.1.0"
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"SQLToMemgraphAgent",
|
|
43
|
+
"HyGM",
|
|
44
|
+
"DatabaseAnalyzerFactory",
|
|
45
|
+
"CypherGenerator",
|
|
46
|
+
"SchemaUtilities",
|
|
47
|
+
]
|
core/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Core business logic for SQL to graph migration.
|
|
3
|
+
|
|
4
|
+
This package contains the main migration orchestration and graph modeling
|
|
5
|
+
logic.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from core.hygm import HyGM, GraphModel, GraphNode, GraphRelationship
|
|
12
|
+
from core.migration_agent import SQLToMemgraphAgent
|
|
13
|
+
|
|
14
|
+
# Add agents root to path for absolute imports
|
|
15
|
+
sys.path.append(str(Path(__file__).parent.parent))
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"SQLToMemgraphAgent",
|
|
19
|
+
"HyGM",
|
|
20
|
+
"GraphModel",
|
|
21
|
+
"GraphNode",
|
|
22
|
+
"GraphRelationship",
|
|
23
|
+
]
|
core/hygm/__init__.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""
|
|
2
|
+
HyGM - Hypothetical Graph Modeling Package
|
|
3
|
+
|
|
4
|
+
A modular system for converting relational database schemas to graph models.
|
|
5
|
+
Supports multiple modeling strategies and interactive refinement.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .hygm import HyGM, ModelingMode, GraphModelingStrategy
|
|
9
|
+
from .models.graph_models import (
|
|
10
|
+
GraphModel,
|
|
11
|
+
GraphNode,
|
|
12
|
+
GraphRelationship,
|
|
13
|
+
GraphProperty,
|
|
14
|
+
GraphIndex,
|
|
15
|
+
GraphConstraint,
|
|
16
|
+
)
|
|
17
|
+
from .models.llm_models import LLMGraphNode, LLMGraphRelationship, LLMGraphModel
|
|
18
|
+
from .models.operations import (
|
|
19
|
+
ChangeNodeLabelOperation,
|
|
20
|
+
RenamePropertyOperation,
|
|
21
|
+
DropPropertyOperation,
|
|
22
|
+
AddPropertyOperation,
|
|
23
|
+
ChangeRelationshipNameOperation,
|
|
24
|
+
DropRelationshipOperation,
|
|
25
|
+
AddIndexOperation,
|
|
26
|
+
DropIndexOperation,
|
|
27
|
+
ModelModifications,
|
|
28
|
+
)
|
|
29
|
+
from .models.sources import (
|
|
30
|
+
PropertySource,
|
|
31
|
+
NodeSource,
|
|
32
|
+
RelationshipSource,
|
|
33
|
+
IndexSource,
|
|
34
|
+
ConstraintSource,
|
|
35
|
+
)
|
|
36
|
+
from .strategies import BaseModelingStrategy, DeterministicStrategy, LLMStrategy
|
|
37
|
+
|
|
38
|
+
__all__ = [
|
|
39
|
+
# Main class
|
|
40
|
+
"HyGM",
|
|
41
|
+
"ModelingMode",
|
|
42
|
+
"GraphModelingStrategy",
|
|
43
|
+
# Core graph models
|
|
44
|
+
"GraphModel",
|
|
45
|
+
"GraphNode",
|
|
46
|
+
"GraphRelationship",
|
|
47
|
+
"GraphProperty",
|
|
48
|
+
"GraphIndex",
|
|
49
|
+
"GraphConstraint",
|
|
50
|
+
# LLM models
|
|
51
|
+
"LLMGraphNode",
|
|
52
|
+
"LLMGraphRelationship",
|
|
53
|
+
"LLMGraphModel",
|
|
54
|
+
# Operations
|
|
55
|
+
"ChangeNodeLabelOperation",
|
|
56
|
+
"RenamePropertyOperation",
|
|
57
|
+
"DropPropertyOperation",
|
|
58
|
+
"AddPropertyOperation",
|
|
59
|
+
"ChangeRelationshipNameOperation",
|
|
60
|
+
"DropRelationshipOperation",
|
|
61
|
+
"AddIndexOperation",
|
|
62
|
+
"DropIndexOperation",
|
|
63
|
+
"ModelModifications",
|
|
64
|
+
# Sources
|
|
65
|
+
"PropertySource",
|
|
66
|
+
"NodeSource",
|
|
67
|
+
"RelationshipSource",
|
|
68
|
+
"IndexSource",
|
|
69
|
+
"ConstraintSource",
|
|
70
|
+
# Strategies
|
|
71
|
+
"BaseModelingStrategy",
|
|
72
|
+
"DeterministicStrategy",
|
|
73
|
+
"LLMStrategy",
|
|
74
|
+
]
|