Commit 31d3acd8 authored by Pierre Dittgen's avatar Pierre Dittgen

SchemaCatalog.references new behaviour and SchemaCatalog.reference_by_name

parent 9774caa5
......@@ -47,11 +47,16 @@ class UploadedFileValidataResource(ValidataResource):
def __detect_format(self):
ext = Path(self.filename).suffix
import ipdb
ipdb.set_trace()
if ext in ('.csv', '.tsv', '.ods', '.xls', '.xlsx'):
return ext[1:]
return None
def build_tabulator_stream_args(self):
"""Uploaded file implementation"""
return (self.build_reader(), {
'format': self.__detect_format()})
options = {
'scheme': 'stream',
# 'format': self.__detect_format()
}
return (self.build_reader(), options)
......@@ -59,7 +59,7 @@ class SchemaInstance():
schema_ref = parameter_dict.get('schema_ref')
# Unknown schema name?
table_schema_reference = table_schema_catalog.references.get(schema_name)
table_schema_reference = table_schema_catalog.reference_by_name.get(schema_name)
if table_schema_reference is None:
return None
......@@ -384,10 +384,10 @@ def hydrate_ui_config(ui_config, table_schema_catalog):
hydrated_ui_config = ui_config.copy()
table_schema_ref_list = []
for name, ref in sorted(table_schema_catalog.references.items(), key=itemgetter(0)):
for ref in table_schema_catalog.references:
table_schema = schema_from_url(ref.get_schema_url())
info = {
"name": name,
"name": ref.name,
**{k: v for k, v in table_schema.descriptor.items() if k != 'fields'}
}
table_schema_ref_list.append(info)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment