Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _guess_variable(self, field_name, field_metadata, inspect_table):
# pylint: disable=import-error
from pymssql import STRING, NUMBER, DATETIME, DECIMAL
type_code, *_ = field_metadata
if type_code in (NUMBER, DECIMAL):
return ContinuousVariable(field_name)
if type_code == DATETIME:
tv = TimeVariable(field_name)
tv.have_date = True
tv.have_time = True
return tv
if type_code == STRING:
if inspect_table:
values = self.get_distinct_values(field_name, inspect_table)
if values:
return DiscreteVariable(field_name, values)
return StringVariable(field_name)