gibson-cli 0.1.0__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.
- api/BaseApi.py +45 -0
- api/Cli.py +248 -0
- bin/gibson.py +16 -0
- command/Api.py +31 -0
- command/Base.py +28 -0
- command/BaseCommand.py +26 -0
- command/Build.py +69 -0
- command/Code.py +198 -0
- command/Conf.py +74 -0
- command/Count.py +35 -0
- command/Dev.py +121 -0
- command/Forget.py +34 -0
- command/Import.py +109 -0
- command/List.py +61 -0
- command/Merge.py +35 -0
- command/Model.py +42 -0
- command/Models.py +31 -0
- command/Modify.py +43 -0
- command/Module.py +42 -0
- command/New.py +38 -0
- command/OpenApi.py +141 -0
- command/Question.py +105 -0
- command/Remove.py +80 -0
- command/Rename.py +71 -0
- command/Rewrite.py +107 -0
- command/Schema.py +42 -0
- command/Schemas.py +31 -0
- command/Show.py +37 -0
- command/Test.py +42 -0
- command/Tests.py +31 -0
- command/Tree.py +92 -0
- command/WarGames.py +35 -0
- command/auth/Auth.py +25 -0
- command/auth/Login.py +17 -0
- command/auth/Logout.py +7 -0
- command/tests/test_command_BaseCommand.py +10 -0
- command/tests/test_command_Conf.py +19 -0
- conf/Api.py +3 -0
- conf/Code.py +9 -0
- conf/Custom.py +4 -0
- conf/Datastore.py +4 -0
- conf/Dependencies.py +24 -0
- conf/Dev.py +15 -0
- conf/Frameworks.py +7 -0
- conf/Modeler.py +3 -0
- conf/Paths.py +10 -0
- conf/Platform.py +16 -0
- conf/Project.py +18 -0
- conf/Version.py +2 -0
- conf/dev/Api.py +5 -0
- conf/dev/Base.py +3 -0
- conf/dev/Model.py +3 -0
- conf/dev/Schema.py +3 -0
- conf/tests/test_conf_Dependencies.py +5 -0
- conf/tests/test_conf_Platform.py +7 -0
- core/CommandRouter.py +249 -0
- core/Configuration.py +418 -0
- core/Conversation.py +270 -0
- core/Env.py +12 -0
- core/Memory.py +148 -0
- core/TimeKeeper.py +12 -0
- core/utils.py +19 -0
- data/default-ref-table.tmpl +4 -0
- data/default-table.tmpl +6 -0
- db/TableExceptions.py +6 -0
- db/tests/test_db_TableExceptions.py +9 -0
- dev/Dev.py +92 -0
- display/Header.py +6 -0
- display/WorkspaceFooter.py +10 -0
- display/WorkspaceHeader.py +8 -0
- display/tests/test_display_Header.py +9 -0
- display/tests/test_display_WorkspaceFooter.py +9 -0
- display/tests/test_display_WorkspaceHeader.py +8 -0
- gibson_cli-0.1.0.dist-info/METADATA +306 -0
- gibson_cli-0.1.0.dist-info/RECORD +102 -0
- gibson_cli-0.1.0.dist-info/WHEEL +5 -0
- gibson_cli-0.1.0.dist-info/entry_points.txt +2 -0
- gibson_cli-0.1.0.dist-info/top_level.txt +12 -0
- lang/Python.py +57 -0
- lang/tests/test_lang_Python.py +70 -0
- services/auth/Server.py +75 -0
- services/code/context/schema/DataDictionary.py +12 -0
- services/code/context/schema/EntityKeys.py +49 -0
- services/code/context/schema/Manager.py +28 -0
- services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +8 -0
- services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +52 -0
- services/code/context/schema/tests/test_code_context_schema_Manager.py +34 -0
- services/code/customization/Authenticator.py +51 -0
- services/code/customization/BaseCustomization.py +12 -0
- services/code/customization/CustomizationManager.py +20 -0
- services/code/customization/tests/test_code_customization_Authenticator.py +53 -0
- services/code/customization/tests/test_code_customization_BaseCustomization.py +14 -0
- structure/Entity.py +115 -0
- structure/constraints/ReferenceConstraint.py +36 -0
- structure/keys/ForeignKey.py +41 -0
- structure/keys/Index.py +64 -0
- structure/keys/IndexAttribute.py +14 -0
- structure/keys/tests/test_ForeignKey.py +80 -0
- structure/keys/tests/test_Index.py +98 -0
- structure/keys/tests/test_IndexAttribute.py +17 -0
- structure/testing.py +194 -0
- structure/tests/test_Entity.py +107 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
from core.Configuration import Configuration
|
4
|
+
from services.code.customization.BaseCustomization import BaseCustomization
|
5
|
+
|
6
|
+
|
7
|
+
def test_preserve_exception():
|
8
|
+
with pytest.raises(NotImplementedError):
|
9
|
+
BaseCustomization(Configuration()).preserve()
|
10
|
+
|
11
|
+
|
12
|
+
def test_restore_exception():
|
13
|
+
with pytest.raises(NotImplementedError):
|
14
|
+
BaseCustomization(Configuration()).restore()
|
structure/Entity.py
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
from structure.keys.ForeignKey import ForeignKey
|
2
|
+
from structure.keys.Index import Index
|
3
|
+
|
4
|
+
|
5
|
+
class Entity:
|
6
|
+
def __init__(self):
|
7
|
+
self.attributes = None
|
8
|
+
self.constraints = None
|
9
|
+
self.keys = None
|
10
|
+
self.name = None
|
11
|
+
self.parameters = None
|
12
|
+
|
13
|
+
def add_attribute(self, name, data_type, after=None, before=None):
|
14
|
+
was_added = False
|
15
|
+
|
16
|
+
json = {
|
17
|
+
"as": None,
|
18
|
+
"bytes": None,
|
19
|
+
"check": None,
|
20
|
+
"comment": None,
|
21
|
+
"data_type": {
|
22
|
+
"formatted": data_type,
|
23
|
+
"raw": data_type,
|
24
|
+
},
|
25
|
+
"default": None,
|
26
|
+
"extra": {"increment": {"auto": None}},
|
27
|
+
"key": {"index": None, "primary": None, "unique": None},
|
28
|
+
"length": None,
|
29
|
+
"name": name,
|
30
|
+
"nullable": None,
|
31
|
+
"numeric": {
|
32
|
+
"precision": None,
|
33
|
+
"scale": None,
|
34
|
+
},
|
35
|
+
"on": None,
|
36
|
+
"reference": None,
|
37
|
+
"sql": f"{name} {data_type}",
|
38
|
+
"unsigned": None,
|
39
|
+
"values": None,
|
40
|
+
}
|
41
|
+
|
42
|
+
attributes = []
|
43
|
+
for attribute in self.attributes:
|
44
|
+
if was_added is False and attribute["name"] == after:
|
45
|
+
was_added = True
|
46
|
+
attributes.append(attribute)
|
47
|
+
attributes.append(json)
|
48
|
+
elif was_added is False and attribute["name"] == before:
|
49
|
+
was_added = True
|
50
|
+
attributes.append(json)
|
51
|
+
attributes.append(attribute)
|
52
|
+
else:
|
53
|
+
attributes.append(attribute)
|
54
|
+
|
55
|
+
if was_added is False:
|
56
|
+
attributes.append(json)
|
57
|
+
|
58
|
+
self.attributes = attributes
|
59
|
+
return self
|
60
|
+
|
61
|
+
def add_foreign_key(self, foreign_key: ForeignKey):
|
62
|
+
self.keys["foreign"].append(foreign_key.json())
|
63
|
+
return self
|
64
|
+
|
65
|
+
def add_index(self, index: Index):
|
66
|
+
self.keys["index"].append(index.json())
|
67
|
+
return self
|
68
|
+
|
69
|
+
def create_statement(self):
|
70
|
+
parts = []
|
71
|
+
for attribute in self.attributes:
|
72
|
+
parts.append(" " + attribute["sql"])
|
73
|
+
|
74
|
+
if self.keys["primary"] is not None:
|
75
|
+
parts.append(" " + self.keys["primary"]["sql"])
|
76
|
+
|
77
|
+
for unique_key in self.keys["unique"]:
|
78
|
+
parts.append(" " + unique_key["sql"])
|
79
|
+
|
80
|
+
for index in self.keys["index"]:
|
81
|
+
parts.append(" " + index["sql"])
|
82
|
+
|
83
|
+
for fk in self.keys["foreign"]:
|
84
|
+
parts.append(" " + fk["sql"])
|
85
|
+
|
86
|
+
for check in self.constraints["check"]:
|
87
|
+
parts.append(" " + check["sql"])
|
88
|
+
|
89
|
+
parameters = self.parameters["sql"]
|
90
|
+
if parameters not in [None, ""]:
|
91
|
+
parameters = " " + parameters
|
92
|
+
else:
|
93
|
+
parameters = ""
|
94
|
+
|
95
|
+
return (
|
96
|
+
f"create table if not exists {self.name}(\n"
|
97
|
+
+ ",\n".join(parts)
|
98
|
+
+ f"\n){parameters}"
|
99
|
+
)
|
100
|
+
|
101
|
+
def import_from_struct(self, data: dict):
|
102
|
+
if "name" in data and "struct" in data:
|
103
|
+
self.name = data["name"]
|
104
|
+
|
105
|
+
for key in data["struct"].keys():
|
106
|
+
setattr(self, key, data["struct"][key])
|
107
|
+
elif "entity" in data and "struct" in data["entity"]:
|
108
|
+
self.name = data["entity"]["name"]
|
109
|
+
|
110
|
+
for key in data["entity"]["struct"].keys():
|
111
|
+
setattr(self, key, data["entity"]["struct"][key])
|
112
|
+
else:
|
113
|
+
raise RuntimeError("cannot import from struct, incorrect data format")
|
114
|
+
|
115
|
+
return self
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class ReferenceConstraint:
|
2
|
+
def __init__(self):
|
3
|
+
self.attributes = None
|
4
|
+
self.match = None
|
5
|
+
self.on_delete = None
|
6
|
+
self.on_update = None
|
7
|
+
self.references = None
|
8
|
+
|
9
|
+
def json(self):
|
10
|
+
return {
|
11
|
+
"attributes": self.attributes,
|
12
|
+
"match": self.match,
|
13
|
+
"on": {"delete": self.on_delete, "update": self.on_update},
|
14
|
+
"references": self.references,
|
15
|
+
"sql": self.sql(),
|
16
|
+
}
|
17
|
+
|
18
|
+
def sql(self):
|
19
|
+
if self.attributes is None or self.attributes == []:
|
20
|
+
raise RuntimeError("reference constraint is missing attributes")
|
21
|
+
|
22
|
+
if self.references is None:
|
23
|
+
raise RuntimeError("reference constraint is missing referenced entity")
|
24
|
+
|
25
|
+
parts = ["references", self.references, "(" + ", ".join(self.attributes) + ")"]
|
26
|
+
|
27
|
+
if self.match is not None:
|
28
|
+
parts.append(f"match {self.match}")
|
29
|
+
|
30
|
+
if self.on_delete is not None:
|
31
|
+
parts.append(f"on delete {self.on_delete}")
|
32
|
+
|
33
|
+
if self.on_update is not None:
|
34
|
+
parts.append(f"on update {self.on_update}")
|
35
|
+
|
36
|
+
return " ".join(parts)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from structure.constraints.ReferenceConstraint import ReferenceConstraint
|
2
|
+
|
3
|
+
|
4
|
+
class ForeignKey:
|
5
|
+
def __init__(self):
|
6
|
+
self.attributes = None
|
7
|
+
self.name = None
|
8
|
+
self.reference = None
|
9
|
+
self.relationship = None
|
10
|
+
self.symbol = None
|
11
|
+
|
12
|
+
def json(self):
|
13
|
+
return {
|
14
|
+
"attributes": self.attributes,
|
15
|
+
"name": self.name,
|
16
|
+
"reference": self.reference.json(),
|
17
|
+
"relationship": {"type": None},
|
18
|
+
"sql": self.sql(),
|
19
|
+
"symbol": self.symbol,
|
20
|
+
}
|
21
|
+
|
22
|
+
def sql(self):
|
23
|
+
if self.attributes is None or self.attributes == []:
|
24
|
+
raise RuntimeError("foreign key is missing attributes")
|
25
|
+
|
26
|
+
if self.reference is None or not isinstance(
|
27
|
+
self.reference, ReferenceConstraint
|
28
|
+
):
|
29
|
+
raise RuntimeError("reference must be instance of ReferenceConstraint")
|
30
|
+
|
31
|
+
parts = []
|
32
|
+
if self.symbol is not None:
|
33
|
+
parts.append(f"constraint {self.symbol}")
|
34
|
+
|
35
|
+
parts.append("foreign key")
|
36
|
+
if self.name is not None:
|
37
|
+
parts.append(self.name)
|
38
|
+
|
39
|
+
parts.append("(" + ", ".join(self.attributes) + ")")
|
40
|
+
|
41
|
+
return " ".join(parts) + " " + self.reference.sql()
|
structure/keys/Index.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
from structure.keys.IndexAttribute import IndexAttribute
|
2
|
+
|
3
|
+
|
4
|
+
class Index:
|
5
|
+
def __init__(self):
|
6
|
+
self.__attribute_name_list = []
|
7
|
+
self.attributes = None
|
8
|
+
self.name = None
|
9
|
+
self.using = None
|
10
|
+
|
11
|
+
def add_attribute(self, name, asc=False, desc=False):
|
12
|
+
if asc is True and desc is True:
|
13
|
+
raise RuntimeError("an index attribute cannot be both asc and desc")
|
14
|
+
|
15
|
+
if self.attributes is None:
|
16
|
+
self.attributes = []
|
17
|
+
|
18
|
+
attribute = IndexAttribute()
|
19
|
+
attribute.name = name
|
20
|
+
|
21
|
+
if asc is True:
|
22
|
+
attribute.asc = True
|
23
|
+
elif desc is True:
|
24
|
+
attribute.desc = True
|
25
|
+
|
26
|
+
self.attributes.append(attribute)
|
27
|
+
self.__attribute_name_list.append(name)
|
28
|
+
|
29
|
+
return self
|
30
|
+
|
31
|
+
def attribute_name_list(self):
|
32
|
+
return self.__attribute_name_list
|
33
|
+
|
34
|
+
def json(self):
|
35
|
+
return {
|
36
|
+
"attributes": self.__attribute_name_list,
|
37
|
+
"name": self.name,
|
38
|
+
"sql": self.sql(),
|
39
|
+
"using": self.using,
|
40
|
+
}
|
41
|
+
|
42
|
+
def reset_attributes(self):
|
43
|
+
self.__attribute_name_list = []
|
44
|
+
self.attributes = None
|
45
|
+
return self
|
46
|
+
|
47
|
+
def sql(self):
|
48
|
+
if self.attributes is None or self.attributes == []:
|
49
|
+
raise RuntimeError("index is missing attributes")
|
50
|
+
|
51
|
+
parts = ["index"]
|
52
|
+
if self.name is not None:
|
53
|
+
parts.append(self.name)
|
54
|
+
|
55
|
+
if self.using is not None:
|
56
|
+
parts.append(f"using {self.using}")
|
57
|
+
|
58
|
+
attributes = []
|
59
|
+
for attribute in self.attributes:
|
60
|
+
attributes.append(attribute.sql())
|
61
|
+
|
62
|
+
parts.append("(" + ", ".join(attributes) + ")")
|
63
|
+
|
64
|
+
return " ".join(parts)
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
from structure.constraints.ReferenceConstraint import ReferenceConstraint
|
4
|
+
from structure.keys.ForeignKey import ForeignKey
|
5
|
+
|
6
|
+
|
7
|
+
def test_sql_exceptions():
|
8
|
+
with pytest.raises(RuntimeError) as e:
|
9
|
+
ForeignKey().sql()
|
10
|
+
|
11
|
+
assert str(e.value) == "foreign key is missing attributes"
|
12
|
+
|
13
|
+
foreign_key = ForeignKey()
|
14
|
+
foreign_key.attributes = ["a"]
|
15
|
+
|
16
|
+
with pytest.raises(RuntimeError) as e:
|
17
|
+
foreign_key.sql()
|
18
|
+
|
19
|
+
assert str(e.value) == "reference must be instance of ReferenceConstraint"
|
20
|
+
|
21
|
+
foreign_key.reference = "abc"
|
22
|
+
|
23
|
+
with pytest.raises(RuntimeError) as e:
|
24
|
+
foreign_key.sql()
|
25
|
+
|
26
|
+
assert str(e.value) == "reference must be instance of ReferenceConstraint"
|
27
|
+
|
28
|
+
|
29
|
+
def test_sql():
|
30
|
+
reference = ReferenceConstraint()
|
31
|
+
reference.attributes = ["a", "b"]
|
32
|
+
reference.references = "other_table"
|
33
|
+
|
34
|
+
foreign_key = ForeignKey()
|
35
|
+
foreign_key.reference = reference
|
36
|
+
|
37
|
+
foreign_key.attributes = ["a", "b"]
|
38
|
+
|
39
|
+
assert foreign_key.sql() == "foreign key (a, b) references other_table (a, b)"
|
40
|
+
|
41
|
+
foreign_key.name = "abc_def_fk"
|
42
|
+
|
43
|
+
assert foreign_key.sql() == (
|
44
|
+
"foreign key abc_def_fk (a, b) references other_table (a, b)"
|
45
|
+
)
|
46
|
+
|
47
|
+
foreign_key.symbol = "foreign_key_symbol"
|
48
|
+
|
49
|
+
assert foreign_key.sql() == (
|
50
|
+
"constraint foreign_key_symbol foreign key abc_def_fk (a, b) "
|
51
|
+
+ "references other_table (a, b)"
|
52
|
+
)
|
53
|
+
|
54
|
+
|
55
|
+
def test_json():
|
56
|
+
reference = ReferenceConstraint()
|
57
|
+
reference.attributes = ["a", "b"]
|
58
|
+
reference.references = "other_table"
|
59
|
+
|
60
|
+
foreign_key = ForeignKey()
|
61
|
+
foreign_key.attributes = ["c", "d"]
|
62
|
+
foreign_key.name = "abc_def_fk"
|
63
|
+
foreign_key.reference = reference
|
64
|
+
foreign_key.symbol = "foreign_key_symbol"
|
65
|
+
|
66
|
+
assert foreign_key.json() == {
|
67
|
+
"attributes": ["c", "d"],
|
68
|
+
"name": "abc_def_fk",
|
69
|
+
"reference": {
|
70
|
+
"attributes": ["a", "b"],
|
71
|
+
"match": None,
|
72
|
+
"on": {"delete": None, "update": None},
|
73
|
+
"references": "other_table",
|
74
|
+
"sql": "references other_table (a, b)",
|
75
|
+
},
|
76
|
+
"relationship": {"type": None},
|
77
|
+
"sql": "constraint foreign_key_symbol foreign key abc_def_fk (c, d) "
|
78
|
+
+ "references other_table (a, b)",
|
79
|
+
"symbol": "foreign_key_symbol",
|
80
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
import pytest
|
2
|
+
|
3
|
+
from structure.keys.Index import Index
|
4
|
+
|
5
|
+
|
6
|
+
def test_sql_exceptions():
|
7
|
+
with pytest.raises(RuntimeError) as e:
|
8
|
+
Index().sql()
|
9
|
+
|
10
|
+
assert str(e.value) == "index is missing attributes"
|
11
|
+
|
12
|
+
|
13
|
+
def test_sql_1():
|
14
|
+
index = Index()
|
15
|
+
index.add_attribute("a").add_attribute("b")
|
16
|
+
|
17
|
+
assert index.sql() == "index (a, b)"
|
18
|
+
|
19
|
+
index.name = "abc_def_idx"
|
20
|
+
|
21
|
+
assert index.sql() == "index abc_def_idx (a, b)"
|
22
|
+
|
23
|
+
index.using = "btree"
|
24
|
+
|
25
|
+
assert index.sql() == "index abc_def_idx using btree (a, b)"
|
26
|
+
|
27
|
+
|
28
|
+
def test_sql_2():
|
29
|
+
index = Index()
|
30
|
+
index.add_attribute("a").add_attribute("b")
|
31
|
+
index.using = "hash"
|
32
|
+
|
33
|
+
assert index.sql() == "index using hash (a, b)"
|
34
|
+
|
35
|
+
|
36
|
+
def test_add_attribute_asc_and_desc_exception():
|
37
|
+
with pytest.raises(RuntimeError) as e:
|
38
|
+
Index().add_attribute("abc", True, True)
|
39
|
+
|
40
|
+
assert str(e.value) == "an index attribute cannot be both asc and desc"
|
41
|
+
|
42
|
+
|
43
|
+
def test_add_attribute_asc():
|
44
|
+
index = Index()
|
45
|
+
index.add_attribute("a", True)
|
46
|
+
|
47
|
+
assert index.sql() == "index (a asc)"
|
48
|
+
|
49
|
+
index = Index()
|
50
|
+
index.add_attribute("a", asc=True)
|
51
|
+
|
52
|
+
assert index.sql() == "index (a asc)"
|
53
|
+
|
54
|
+
|
55
|
+
def test_add_attribute_desc():
|
56
|
+
index = Index()
|
57
|
+
index.add_attribute("a", False, True)
|
58
|
+
|
59
|
+
assert index.sql() == "index (a desc)"
|
60
|
+
|
61
|
+
index = Index()
|
62
|
+
index.add_attribute("a", desc=True)
|
63
|
+
|
64
|
+
assert index.sql() == "index (a desc)"
|
65
|
+
|
66
|
+
|
67
|
+
def test_attribute_name_list():
|
68
|
+
index = Index()
|
69
|
+
index.add_attribute("a").add_attribute("b")
|
70
|
+
|
71
|
+
assert index.attribute_name_list() == ["a", "b"]
|
72
|
+
|
73
|
+
|
74
|
+
def test_reset_attributes():
|
75
|
+
index = Index()
|
76
|
+
index.add_attribute("a").add_attribute("b")
|
77
|
+
|
78
|
+
assert len(index.attributes) == 2
|
79
|
+
assert index.attribute_name_list() == ["a", "b"]
|
80
|
+
|
81
|
+
index.reset_attributes()
|
82
|
+
|
83
|
+
assert index.attributes is None
|
84
|
+
assert index.attribute_name_list() == []
|
85
|
+
|
86
|
+
|
87
|
+
def test_json():
|
88
|
+
index = Index()
|
89
|
+
index.add_attribute("a").add_attribute("b")
|
90
|
+
index.name = "abc_def_idx"
|
91
|
+
index.using = "btree"
|
92
|
+
|
93
|
+
assert index.json() == {
|
94
|
+
"attributes": ["a", "b"],
|
95
|
+
"name": "abc_def_idx",
|
96
|
+
"sql": "index abc_def_idx using btree (a, b)",
|
97
|
+
"using": "btree",
|
98
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from structure.keys.IndexAttribute import IndexAttribute
|
2
|
+
|
3
|
+
|
4
|
+
def test_sql():
|
5
|
+
index_attribute = IndexAttribute()
|
6
|
+
index_attribute.name = "abc"
|
7
|
+
|
8
|
+
assert index_attribute.sql() == "abc"
|
9
|
+
|
10
|
+
index_attribute.asc = True
|
11
|
+
|
12
|
+
assert index_attribute.sql() == "abc asc"
|
13
|
+
|
14
|
+
index_attribute.asc = None
|
15
|
+
index_attribute.desc = True
|
16
|
+
|
17
|
+
assert index_attribute.sql() == "abc desc"
|
structure/testing.py
ADDED
@@ -0,0 +1,194 @@
|
|
1
|
+
from structure.Entity import Entity
|
2
|
+
|
3
|
+
|
4
|
+
def structure_testing_get_entity():
|
5
|
+
entity = Entity()
|
6
|
+
entity.attributes = [
|
7
|
+
{
|
8
|
+
"as_": None,
|
9
|
+
"bytes_": None,
|
10
|
+
"check": None,
|
11
|
+
"comment": None,
|
12
|
+
"data_type": {"formatted": "bigint", "raw": "bigint"},
|
13
|
+
"default": None,
|
14
|
+
"extra": {"increment": {"auto": True}},
|
15
|
+
"key": {"index": None, "primary": True, "unique": None},
|
16
|
+
"length": None,
|
17
|
+
"name": "id",
|
18
|
+
"nullable": False,
|
19
|
+
"numeric": {"precision": None, "scale": None},
|
20
|
+
"on": None,
|
21
|
+
"reference": None,
|
22
|
+
"sql": "id bigint not null auto_increment primary key",
|
23
|
+
"unsigned": None,
|
24
|
+
"values": None,
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"as_": None,
|
28
|
+
"bytes_": None,
|
29
|
+
"check": None,
|
30
|
+
"comment": None,
|
31
|
+
"data_type": {"formatted": "varchar(36)", "raw": "varchar"},
|
32
|
+
"default": None,
|
33
|
+
"extra": {"increment": {"auto": None}},
|
34
|
+
"key": {"index": None, "primary": None, "unique": True},
|
35
|
+
"length": 36,
|
36
|
+
"name": "uuid",
|
37
|
+
"nullable": False,
|
38
|
+
"numeric": {"precision": None, "scale": None},
|
39
|
+
"on": None,
|
40
|
+
"reference": None,
|
41
|
+
"sql": "uuid varchar(36) not null unique key",
|
42
|
+
"unsigned": None,
|
43
|
+
"values": None,
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"as_": None,
|
47
|
+
"bytes_": None,
|
48
|
+
"check": None,
|
49
|
+
"comment": None,
|
50
|
+
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
51
|
+
"default": "current_timestamp",
|
52
|
+
"extra": {"increment": {"auto": None}},
|
53
|
+
"key": {"index": None, "primary": None, "unique": None},
|
54
|
+
"length": None,
|
55
|
+
"name": "date_created",
|
56
|
+
"nullable": False,
|
57
|
+
"numeric": {"precision": None, "scale": None},
|
58
|
+
"on": None,
|
59
|
+
"reference": None,
|
60
|
+
"sql": "date_created datetime not null default current_timestamp",
|
61
|
+
"unsigned": None,
|
62
|
+
"values": None,
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"as_": None,
|
66
|
+
"bytes_": None,
|
67
|
+
"check": None,
|
68
|
+
"comment": None,
|
69
|
+
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
70
|
+
"default": "null",
|
71
|
+
"extra": {"increment": {"auto": None}},
|
72
|
+
"key": {"index": None, "primary": None, "unique": None},
|
73
|
+
"length": None,
|
74
|
+
"name": "date_updated",
|
75
|
+
"nullable": None,
|
76
|
+
"numeric": {"precision": None, "scale": None},
|
77
|
+
"on": "update current_timestamp",
|
78
|
+
"reference": None,
|
79
|
+
"sql": "date_updated datetime default null on update current_timestamp",
|
80
|
+
"unsigned": None,
|
81
|
+
"values": None,
|
82
|
+
},
|
83
|
+
]
|
84
|
+
entity.constraints = {"check": []}
|
85
|
+
entity.keys = {"foreign": [], "index": [], "primary": None, "unique": []}
|
86
|
+
entity.name = "abc_def"
|
87
|
+
entity.parameters = {
|
88
|
+
"auto": None,
|
89
|
+
"charset": None,
|
90
|
+
"collate": None,
|
91
|
+
"default": None,
|
92
|
+
"engine": None,
|
93
|
+
"sql": None,
|
94
|
+
}
|
95
|
+
|
96
|
+
return entity
|
97
|
+
|
98
|
+
|
99
|
+
def structure_testing_get_struct_data():
|
100
|
+
return {
|
101
|
+
"entity": {
|
102
|
+
"name": "abc_def",
|
103
|
+
"struct": {
|
104
|
+
"attributes": [
|
105
|
+
{
|
106
|
+
"as_": None,
|
107
|
+
"bytes_": None,
|
108
|
+
"check": None,
|
109
|
+
"comment": None,
|
110
|
+
"data_type": {"formatted": "bigint", "raw": "bigint"},
|
111
|
+
"default": None,
|
112
|
+
"extra": {"increment": {"auto": True}},
|
113
|
+
"key": {"index": None, "primary": True, "unique": None},
|
114
|
+
"length": None,
|
115
|
+
"name": "id",
|
116
|
+
"nullable": False,
|
117
|
+
"numeric": {"precision": None, "scale": None},
|
118
|
+
"on": None,
|
119
|
+
"reference": None,
|
120
|
+
"sql": "id bigint not null auto_increment primary key",
|
121
|
+
"unsigned": None,
|
122
|
+
"values": None,
|
123
|
+
},
|
124
|
+
{
|
125
|
+
"as_": None,
|
126
|
+
"bytes_": None,
|
127
|
+
"check": None,
|
128
|
+
"comment": None,
|
129
|
+
"data_type": {"formatted": "varchar(36)", "raw": "varchar"},
|
130
|
+
"default": None,
|
131
|
+
"extra": {"increment": {"auto": None}},
|
132
|
+
"key": {"index": None, "primary": None, "unique": True},
|
133
|
+
"length": 36,
|
134
|
+
"name": "uuid",
|
135
|
+
"nullable": False,
|
136
|
+
"numeric": {"precision": None, "scale": None},
|
137
|
+
"on": None,
|
138
|
+
"reference": None,
|
139
|
+
"sql": "uuid varchar(36) not null unique key",
|
140
|
+
"unsigned": None,
|
141
|
+
"values": None,
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"as_": None,
|
145
|
+
"bytes_": None,
|
146
|
+
"check": None,
|
147
|
+
"comment": None,
|
148
|
+
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
149
|
+
"default": "current_timestamp",
|
150
|
+
"extra": {"increment": {"auto": None}},
|
151
|
+
"key": {"index": None, "primary": None, "unique": None},
|
152
|
+
"length": None,
|
153
|
+
"name": "date_created",
|
154
|
+
"nullable": False,
|
155
|
+
"numeric": {"precision": None, "scale": None},
|
156
|
+
"on": None,
|
157
|
+
"reference": None,
|
158
|
+
"sql": "date_created datetime not null default current_timestamp",
|
159
|
+
"unsigned": None,
|
160
|
+
"values": None,
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"as_": None,
|
164
|
+
"bytes_": None,
|
165
|
+
"check": None,
|
166
|
+
"comment": None,
|
167
|
+
"data_type": {"formatted": "datetime", "raw": "datetime"},
|
168
|
+
"default": "null",
|
169
|
+
"extra": {"increment": {"auto": None}},
|
170
|
+
"key": {"index": None, "primary": None, "unique": None},
|
171
|
+
"length": None,
|
172
|
+
"name": "date_updated",
|
173
|
+
"nullable": None,
|
174
|
+
"numeric": {"precision": None, "scale": None},
|
175
|
+
"on": "update current_timestamp",
|
176
|
+
"reference": None,
|
177
|
+
"sql": "date_updated datetime default null on update current_timestamp",
|
178
|
+
"unsigned": None,
|
179
|
+
"values": None,
|
180
|
+
},
|
181
|
+
],
|
182
|
+
"constraints": {"check": []},
|
183
|
+
"keys": {"foreign": [], "index": [], "primary": None, "unique": []},
|
184
|
+
"parameters": {
|
185
|
+
"auto": None,
|
186
|
+
"charset": None,
|
187
|
+
"collate": None,
|
188
|
+
"default": None,
|
189
|
+
"engine": None,
|
190
|
+
"sql": None,
|
191
|
+
},
|
192
|
+
},
|
193
|
+
}
|
194
|
+
}
|