MCPcopy Create free account
hub / github.com/FlyingFeather/DEA-SQL / Schema

Class Schema

hardness_eval.py:76–105  ·  view source on GitHub ↗

Simple schema which maps table&column to a unique identifier

Source from the content-addressed store, hash-verified

74
75
76class Schema:
77 """
78 Simple schema which maps table&column to a unique identifier
79 """
80
81 def __init__(self, schema):
82 self._schema = schema
83 self._idMap = self._map(self._schema)
84
85 @property
86 def schema(self):
87 return self._schema
88
89 @property
90 def idMap(self):
91 return self._idMap
92
93 def _map(self, schema):
94 idMap = {'*': "__all__"}
95 id = 1
96 for key, vals in schema.items():
97 for val in vals:
98 idMap[key.lower() + "." + val.lower()] = "__" + key.lower() + "." + val.lower() + "__"
99 id += 1
100
101 for key in schema:
102 idMap[key.lower()] = "__" + key.lower() + "__"
103 id += 1
104
105 return idMap
106
107
108def get_schema(db):

Callers 1

get_hardnessFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected