Registering an Astore model with data of type 'Varchar' error when creating project and registering model at the same mode (force = True).
If the project already exists you can bypass the check, leading to a proper registration (or force = False).
Sample code:
result = conn.astore.describe(rstore= dict(name = "gb_astore", caslib= "Public" ), epcode=False)
var_list = [print(v) for v in result.InputVariables.itertuples()]
astore = conn.CASTable('gb_astore', caslib = "public")
model = register_model(astore, 'gb_swat', 'WebinarBrHmeq', force = True)
Error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[120], line 2
1 astore = conn.CASTable('gb_astore', caslib = "public")
----> 2 model = register_model(astore, 'gb_swat', 'WebinarBrHmeq2', force = True) #force = True to create the project
File /opt/conda/lib/python3.10/site-packages/sasctl/tasks.py:343, in register_model(model, name, project, repository, input, version, files, force, record_packages)
340 model_props = utils.astore._get_model_properties(result)
342 # Format input & output variable info as lists of dicts
--> 343 input_vars = [
344 utils.astore.get_variable_properties(v)
345 for v in result.InputVariables.itertuples()
346 ]
347 output_vars = [
348 utils.astore.get_variable_properties(v)
349 for v in result.OutputVariables.itertuples()
350 ]
352 # Set the variable 'role' if it wasn't included (not all astores specify)
File /opt/conda/lib/python3.10/site-packages/sasctl/tasks.py:344, in <listcomp>(.0)
340 model_props = utils.astore._get_model_properties(result)
342 # Format input & output variable info as lists of dicts
343 input_vars = [
--> 344 utils.astore.get_variable_properties(v)
345 for v in result.InputVariables.itertuples()
346 ]
347 output_vars = [
348 utils.astore.get_variable_properties(v)
349 for v in result.OutputVariables.itertuples()
350 ]
352 # Set the variable 'role' if it wasn't included (not all astores specify)
File /opt/conda/lib/python3.10/site-packages/sasctl/utils/astore.py:316, in get_variable_properties(var)
314 # Input variable table has Type & RawType columns, but RawType aligns with Type column from Output variable table.
315 if hasattr(var, "RawType"):
--> 316 meta["type"] = type_mapping[var.RawType.strip().lower()]
317 else:
318 meta["type"] = type_mapping[var.Type.strip().lower()]
KeyError: 'varchar'
Registering an Astore model with data of type 'Varchar' error when creating project and registering model at the same mode (
force = True
). If the project already exists you can bypass the check, leading to a proper registration (orforce = False
).Sample code:
Output:
Error: