def restore_type(self, type):
<EOL>mapping = {<EOL>ARRAY: '<STR_LIT>',<EOL>sa.Boolean: '<STR_LIT>',<EOL>sa.Date: '<STR_LIT:date>',<EOL>sa.DateTime: '<STR_LIT>',<EOL>sa.Float: '<STR_LIT>',<EOL>sa.Integer: '<STR_LIT>',<EOL>JSONB: '<STR_LIT:object>',<EOL>JSON: '<STR_LIT:object>',<EOL>sa.Numeric: '<STR_LIT>',<EOL>sa.Text: '<STR_LIT:string>',<EOL>sa.Time: '<STR_LIT:time>',<EOL>sa.VARCHAR: '<STR_LIT:string>',<EOL>UUID: '<STR_LIT:string>',<EOL>}<EOL>field_type = None<EOL>for key, value in mapping.items():<EOL><INDENT>if isinstance(type, key):<EOL><INDENT>field_type = value<EOL><DEDENT><DEDENT>if field_type is None:<EOL><INDENT>message = '<STR_LIT>'<EOL>raise tableschema.exceptions.StorageError(message % type)<EOL><DEDENT>return field_type<EOL>
Restore type from SQL