atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
13 stars 4 forks source link

Error when nested arrays with refs are being converted from one file type to another #736

Open karina-klinkeviciute opened 2 months ago

karina-klinkeviciute commented 2 months ago

When trying to convert a manifest from Excel to csv or mmd format, I get the following error:

NestedDataTypeMissmatch: While nesting, 'ref' type cannot be cast to 'array' type.

This error happens when there is a ref property nested inside an array property.

full_name = 'extract.data[]' │ │ │ │ given_row = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'dataset': None, │ │ │ │ │ 'resource': None, │ │ │ │ │ 'base': None, │ │ │ │ │ 'model': None, │ │ │ │ │ 'property': 'extract.data[].tempdocument', │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'ref': 'Tempdocument', │ │ │ │ │ 'source': 'TEMPDOCUMENT', │ │ │ │ │ 'prepare': None, │ │ │ │ │ ... +5 │ │ │ │ }

karina-klinkeviciute commented 2 months ago

─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/cli/manifest.py:62 in │ │ copy │ │ │ │ 59 ): │ │ 60 │ """Copy models from CSV manifest files into another CSV manifest file""" │ │ 61 │ context: Context = ctx.obj │ │ ❱ 62 │ copy_manifest( │ │ 63 │ │ context, │ │ 64 │ │ source=source, │ │ 65 │ │ access=access, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ access = 'private' │ │ │ │ columns = None │ │ │ │ context = <spinta.components.Context(cli:0) at 0x73860ed8e890> │ │ │ │ ctx = <click.core.Context object at 0x73860ed8f550> │ │ │ │ format_names = False │ │ │ │ manifests = [ │ │ │ │ │ │ │ │ │ '/home/karina/work/vssa/spinta/xsds/taar_result_naujas/dsa_1293_TAAR_is… │ │ │ │ ] │ │ │ │ order_by = None │ │ │ │ output = 'taar1293.csv' │ │ │ │ rename_duplicates = False │ │ │ │ source = True │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/cli/manifest.py:133 in │ │ copy_manifest │ │ │ │ 130 │ │ elif internal: │ │ 131 │ │ │ write_internal_sql_manifest(context, output, rows) │ │ 132 │ │ else: │ │ ❱ 133 │ │ │ write_tabular_manifest(context, output, rows) │ │ 134 │ else: │ │ 135 │ │ echo(render_tabular_manifest_rows(rows, cols)) │ │ 136 │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ access = <Access.private: 0> │ │ │ │ cols = None │ │ │ │ columns = None │ │ │ │ context = <spinta.components.Context(cli:0) at 0x73860ed8e890> │ │ │ │ format_names = False │ │ │ │ internal = False │ │ │ │ manifests = [ │ │ │ │ │ │ │ │ │ '/home/karina/work/vssa/spinta/xsds/taar_result_naujas/dsa_1293_TAAR_is… │ │ │ │ ] │ │ │ │ order_by = None │ │ │ │ output = 'taar1293.csv' │ │ │ │ output_type = None │ │ │ │ rename_duplicates = False │ │ │ │ rows = <generator object _read_and_return_rows at 0x73860c93d770> │ │ │ │ source = True │ │ │ │ verbose = True │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:2596 in write_tabular_manifest │ │ │ │ 2593 │ │ │ 2594 │ rows = ({c: row[c] for c in cols} for row in rows) │ │ 2595 │ if path.endswith('.csv'): │ │ ❱ 2596 │ │ write_csv(pathlib.Path(path), rows, cols) │ │ 2597 │ elif path.endswith('.xlsx'): │ │ 2598 │ │ write_xlsx(pathlib.Path(path), rows, cols) │ │ 2599 │ else: │ │ │ │ ╭───────────────────────────────────────── locals ─────────────────────────────────────────╮ │ │ │ cols = [ │ │ │ │ │ 'id', │ │ │ │ │ 'dataset', │ │ │ │ │ 'resource', │ │ │ │ │ 'base', │ │ │ │ │ 'model', │ │ │ │ │ 'property', │ │ │ │ │ 'type', │ │ │ │ │ 'ref', │ │ │ │ │ 'source', │ │ │ │ │ 'prepare', │ │ │ │ │ ... +5 │ │ │ │ ] │ │ │ │ context = <spinta.components.Context(cli:0) at 0x73860ed8e890> │ │ │ │ path = 'taar1293.csv' │ │ │ │ rows = <generator object write_tabular_manifest.. at 0x73860c93dfc0> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:2611 in write_csv │ │ │ │ 2608 │ with path.open('w') as f: │ │ 2609 │ │ writer = csv.DictWriter(f, fieldnames=cols) │ │ 2610 │ │ writer.writeheader() │ │ ❱ 2611 │ │ writer.writerows(rows) │ │ 2612 │ │ 2613 │ │ 2614 def write_xlsx( │ │ │ │ ╭──────────────────────────────────────── locals ─────────────────────────────────────────╮ │ │ │ cols = [ │ │ │ │ │ 'id', │ │ │ │ │ 'dataset', │ │ │ │ │ 'resource', │ │ │ │ │ 'base', │ │ │ │ │ 'model', │ │ │ │ │ 'property', │ │ │ │ │ 'type', │ │ │ │ │ 'ref', │ │ │ │ │ 'source', │ │ │ │ │ 'prepare', │ │ │ │ │ ... +5 │ │ │ │ ] │ │ │ │ f = <_io.TextIOWrapper name='taar1293.csv' mode='w' encoding='UTF-8'> │ │ │ │ path = PosixPath('taar1293.csv') │ │ │ │ rows = <generator object write_tabular_manifest.. at 0x73860c93dfc0> │ │ │ │ writer = <csv.DictWriter object at 0x738609282710> │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/lib/python3.10/csv.py:157 in writerows │ │ │ │ 154 │ │ return self.writer.writerow(self._dict_to_list(rowdict)) │ │ 155 │ │ │ 156 │ def writerows(self, rowdicts): │ │ ❱ 157 │ │ return self.writer.writerows(map(self._dict_to_list, rowdicts)) │ │ 158 │ │ 159 # Guard Sniffer's type checking against builds that exclude complex() │ │ 160 try: │ │ │ │ ╭───────────────────────────────────────── locals ──────────────────────────────────────────╮ │ │ │ rowdicts = <generator object write_tabular_manifest.. at 0x73860c93dfc0> │ │ │ │ self = <csv.DictWriter object at 0x738609282710> │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:2594 in │ │ │ │ 2591 │ elif isinstance(rows, Manifest): │ │ 2592 │ │ rows = datasets_to_tabular(context, rows) │ │ 2593 │ │ │ ❱ 2594 │ rows = ({c: row[c] for c in cols} for row in rows) │ │ 2595 │ if path.endswith('.csv'): │ │ 2596 │ │ write_csv(pathlib.Path(path), rows, cols) │ │ 2597 │ elif path.endswith('.xlsx'): │ │ │ │ ╭───────────────────────────── locals ──────────────────────────────╮ │ │ │ .0 = <generator object _read_and_return_rows at 0x73860c93d770> │ │ │ │ cols = [ │ │ │ │ │ 'id', │ │ │ │ │ 'dataset', │ │ │ │ │ 'resource', │ │ │ │ │ 'base', │ │ │ │ │ 'model', │ │ │ │ │ 'property', │ │ │ │ │ 'type', │ │ │ │ │ 'ref', │ │ │ │ │ 'source', │ │ │ │ │ 'prepare', │ │ │ │ │ ... +5 │ │ │ │ ] │ │ │ ╰───────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/cli/manifest.py:176 in │ │ _read_and_return_rows │ │ │ │ 173 │ verbose: bool = True, │ │ 174 ) -> Iterator[ManifestRow]: │ │ 175 │ context = configure_context(context, manifests) │ │ ❱ 176 │ store = load_manifest( │ │ 177 │ │ context, │ │ 178 │ │ rename_duplicates=rename_duplicates, │ │ 179 │ │ load_internal=False, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ access = <Access.private: 0> │ │ │ │ context = <spinta.components.Context(cli:0 < configure:0) at 0x738609282410> │ │ │ │ external = True │ │ │ │ format_names = False │ │ │ │ manifests = [ │ │ │ │ │ │ │ │ │ '/home/karina/work/vssa/spinta/xsds/taar_result_naujas/dsa_1293_TAAR_is… │ │ │ │ ] │ │ │ │ order_by = None │ │ │ │ rename_duplicates = False │ │ │ │ verbose = True │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/cli/helpers/store.py:120 │ │ in load_manifest │ │ │ │ 117 │ │ │ │ f"Loading {type(store.manifest).name} " │ │ 118 │ │ │ │ f"manifest {store.manifest.name}" │ │ 119 │ │ │ ) │ │ ❱ 120 │ commands.load( │ │ 121 │ │ context, store.manifest, │ │ 122 │ │ rename_duplicates=rename_duplicates, │ │ 123 │ │ load_internal=load_internal, │ │ │ │ ╭──────────────────────────────────────── locals ────────────────────────────────────────╮ │ │ │ context = <spinta.components.Context(cli:0 < configure:0) at 0x738609282410> │ │ │ │ ensure_config_dir = False │ │ │ │ full_load = True │ │ │ │ load_internal = False │ │ │ │ rename_duplicates = False │ │ │ │ store = <spinta.components.Store object at 0x73860c9698d0> │ │ │ │ verbose = True │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/multipledispatch/dispatcher.py: │ │ 279 in call │ │ │ │ 276 │ │ │ │ ) │ │ 277 │ │ │ self._cache[types] = func │ │ 278 │ │ try: │ │ ❱ 279 │ │ │ return func(*args, kwargs) │ │ 280 │ │ │ │ 281 │ │ except MDNotImplementedError: │ │ 282 │ │ │ funcs = self.dispatch_iter(types) │ │ │ │ ╭───────────────────────────────────── locals ─────────────────────────────────────╮ │ │ │ args = ( │ │ │ │ │ <spinta.components.Context(cli:0 < configure:0) at 0x738609282410>, │ │ │ │ │ <spinta.manifests.yaml.components.InlineManifest(name='default')> │ │ │ │ ) │ │ │ │ func = <function load at 0x73860c460d30> │ │ │ │ kwargs = {'rename_duplicates': False, 'load_internal': False, 'full_load': True} │ │ │ │ self = │ │ │ │ types = ( │ │ │ │ │ <class 'spinta.components.Context'>, │ │ │ │ │ <class 'spinta.manifests.yaml.components.InlineManifest'> │ │ │ │ ) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/yaml/commands/ │ │ load.py:110 in load │ │ │ │ 107 │ │ load_manifest_nodes(context, manifest, schemas) │ │ 108 │ │ │ 109 │ for source in manifest.sync: │ │ ❱ 110 │ │ commands.load( │ │ 111 │ │ │ context, source, │ │ 112 │ │ │ into=into or manifest, │ │ 113 │ │ │ freezed=freezed, │ │ │ │ ╭───────────────────────────────────────── locals ─────────────────────────────────────────╮ │ │ │ context = <spinta.components.Context(cli:0 < configure:0) at 0x738609282410> │ │ │ │ freezed = True │ │ │ │ full_load = True │ │ │ │ into = None │ │ │ │ load_internal = False │ │ │ │ manifest = <spinta.manifests.yaml.components.InlineManifest(name='default')> │ │ │ │ rename_duplicates = False │ │ │ │ schemas = <generator object read_inline_manifest_schemas at 0x73860927d700> │ │ │ │ source = <spinta.manifests.tabular.components.XlsxManifest(name='manifest0')> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/multipledispatch/dispatcher.py: │ │ 279 in call │ │ │ │ 276 │ │ │ │ ) │ │ 277 │ │ │ self._cache[types] = func │ │ 278 │ │ try: │ │ ❱ 279 │ │ │ return func(args, kwargs) │ │ 280 │ │ │ │ 281 │ │ except MDNotImplementedError: │ │ 282 │ │ │ funcs = self.dispatch_iter(*types) │ │ │ │ ╭──────────────────────────────────────── locals ─────────────────────────────────────────╮ │ │ │ args = ( │ │ │ │ │ <spinta.components.Context(cli:0 < configure:0) at 0x738609282410>, │ │ │ │ │ <spinta.manifests.tabular.components.XlsxManifest(name='manifest0')> │ │ │ │ ) │ │ │ │ func = <function load at 0x73860c461000> │ │ │ │ kwargs = { │ │ │ │ │ 'into': <spinta.manifests.yaml.components.InlineManifest(name='default')>, │ │ │ │ │ 'freezed': True, │ │ │ │ │ 'rename_duplicates': False, │ │ │ │ │ 'load_internal': False, │ │ │ │ │ 'full_load': True │ │ │ │ } │ │ │ │ self = │ │ │ │ types = ( │ │ │ │ │ <class 'spinta.components.Context'>, │ │ │ │ │ <class 'spinta.manifests.tabular.components.XlsxManifest'> │ │ │ │ ) │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/comman │ │ ds/load.py:59 in load │ │ │ │ 56 │ │ │ file=file, │ │ 57 │ │ │ rename_duplicates=rename_duplicates, │ │ 58 │ │ ) │ │ ❱ 59 │ │ load_manifest_nodes(context, into, schemas, source=manifest) │ │ 60 │ else: │ │ 61 │ │ log.info( │ │ 62 │ │ │ 'Loading freezed manifest %r from %s.', │ │ │ │ ╭───────────────────────────────────────── locals ─────────────────────────────────────────╮ │ │ │ context = <spinta.components.Context(cli:0 < configure:0) at 0x738609282410> │ │ │ │ file = None │ │ │ │ freezed = True │ │ │ │ full_load = True │ │ │ │ into = <spinta.manifests.yaml.components.InlineManifest(name='default')> │ │ │ │ load_internal = False │ │ │ │ manifest = <spinta.manifests.tabular.components.XlsxManifest(name='manifest0')> │ │ │ │ rename_duplicates = False │ │ │ │ schemas = <generator object read_tabular_manifest at 0x73860927cc10> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/helpers.py:133 │ │ in load_manifest_nodes │ │ │ │ 130 ) -> None: │ │ 131 │ to_link = [] │ │ 132 │ config = context.get('config') │ │ ❱ 133 │ for eid, schema in schemas: │ │ 134 │ │ if schema.get('type') == 'manifest': │ │ 135 │ │ │ _load_manifest(context, manifest, schema, eid) │ │ 136 │ │ else: │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ config = <spinta.components.Config object at 0x73860c30fe20> │ │ │ │ context = <spinta.components.Context(cli:0 < configure:0) at 0x738609282410> │ │ │ │ eid = 'Sheet1:33' │ │ │ │ link = False │ │ │ │ manifest = <spinta.manifests.yaml.components.InlineManifest(name='default')> │ │ │ │ node = <spinta.components.Model(name='n1293_taar_issami_informacija_pagal_fizinio_asmen… │ │ │ │ schema = { │ │ │ │ │ 'type': 'model', │ │ │ │ │ 'id': None, │ │ │ │ │ 'name': │ │ │ │ 'n1293_taar_issami_informacija_pagal_fizinio_asmens_koda/SearchParameters1', │ │ │ │ │ 'base': None, │ │ │ │ │ 'level': None, │ │ │ │ │ 'access': None, │ │ │ │ │ 'title': None, │ │ │ │ │ 'description': None, │ │ │ │ │ 'properties': { │ │ │ │ │ │ 'pranesimo_nr': { │ │ │ │ │ │ │ 'id': None, │ │ │ │ │ │ │ 'type': 'string', │ │ │ │ │ │ │ 'type_args': [], │ │ │ │ │ │ │ 'level': None, │ │ │ │ │ │ │ 'access': None, │ │ │ │ │ │ │ 'uri': None, │ │ │ │ │ │ │ 'title': None, │ │ │ │ │ │ │ 'description': None, │ │ │ │ │ │ │ 'required': False, │ │ │ │ │ │ │ 'unique': False, │ │ │ │ │ │ │ ... +4 │ │ │ │ │ │ }, │ │ │ │ │ │ 'search_type': { │ │ │ │ │ │ │ 'id': None, │ │ │ │ │ │ │ 'type': 'string', │ │ │ │ │ │ │ 'type_args': [], │ │ │ │ │ │ │ 'level': None, │ │ │ │ │ │ │ 'access': None, │ │ │ │ │ │ │ 'uri': None, │ │ │ │ │ │ │ 'title': None, │ │ │ │ │ │ │ 'description': None, │ │ │ │ │ │ │ 'required': False, │ │ │ │ │ │ │ 'unique': False, │ │ │ │ │ │ │ ... +4 │ │ │ │ │ │ }, │ │ │ │ │ │ 'taa_busena': { │ │ │ │ │ │ │ 'id': None, │ │ │ │ │ │ │ 'type': 'string', │ │ │ │ │ │ │ 'type_args': [], │ │ │ │ │ │ │ 'level': None, │ │ │ │ │ │ │ 'access': None, │ │ │ │ │ │ │ 'uri': None, │ │ │ │ │ │ │ 'title': None, │ │ │ │ │ │ │ 'description': None, │ │ │ │ │ │ │ 'required': False, │ │ │ │ │ │ │ 'unique': False, │ │ │ │ │ │ │ ... +4 │ │ │ │ │ │ }, │ │ │ │ │ │ 'turto_tipas': { │ │ │ │ │ │ │ 'id': None, │ │ │ │ │ │ │ 'type': 'string', │ │ │ │ │ │ │ 'type_args': [], │ │ │ │ │ │ │ 'level': None, │ │ │ │ │ │ │ 'access': None, │ │ │ │ │ │ │ 'uri': None, │ │ │ │ │ │ │ 'title': None, │ │ │ │ │ │ │ 'description': None, │ │ │ │ │ │ │ 'required': False, │ │ │ │ │ │ │ 'unique': False, │ │ │ │ │ │ │ ... +4 │ │ │ │ │ │ } │ │ │ │ │ }, │ │ │ │ │ 'uri': None, │ │ │ │ │ ... +3 │ │ │ │ } │ │ │ │ schemas = <generator object read_tabular_manifest at 0x73860927cc10> │ │ │ │ source = <spinta.manifests.tabular.components.XlsxManifest(name='manifest0')> │ │ │ │ to_link = [] │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:1640 in read_tabularmanifest │ │ │ │ 1637 │ else: │ │ 1638 │ │ raise ValueError(f"Unknown tabular manifest format {format!r}.") │ │ 1639 │ │ │ ❱ 1640 │ yield from _read_tabular_manifest_rows( │ │ 1641 │ │ path, │ │ 1642 │ │ rows, │ │ 1643 │ │ rename_duplicates=renameduplicates, │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ file = None │ │ │ │ format = <TabularFormat.XLSX: 'xlsx'> │ │ │ │ path = '/home/karina/work/vssa/spinta/xsds/taar_result_naujas/dsa_1293_TAAR_is… │ │ │ │ rename_duplicates = False │ │ │ │ rows = <generator object _read_xlsx_manifest at 0x73860927c890> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:1595 in _read_tabular_manifest_rows │ │ │ │ 1592 │ │ dimension = _detect_dimension(path, line, row) │ │ 1593 │ │ Reader = READERS[dimension] │ │ 1594 │ │ reader = Reader(state, path, line, allow_updates=allowupdates) │ │ ❱ 1595 │ │ reader.read(row) │ │ 1596 │ │ yield from state.release(reader) │ │ 1597 │ │ │ 1598 │ yield from state.release() │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ = '1' │ │ │ │ allow_updates = False │ │ │ │ defaults = { │ │ │ │ │ 'id': '', │ │ │ │ │ 'dataset': '', │ │ │ │ │ 'resource': '', │ │ │ │ │ 'base': '', │ │ │ │ │ 'model': '', │ │ │ │ │ 'property': '', │ │ │ │ │ 'type': '', │ │ │ │ │ 'ref': '', │ │ │ │ │ 'source': '', │ │ │ │ │ 'prepare': '', │ │ │ │ │ ... +5 │ │ │ │ } │ │ │ │ dimension = 'property' │ │ │ │ header = [ │ │ │ │ │ 'id', │ │ │ │ │ 'dataset', │ │ │ │ │ 'resource', │ │ │ │ │ 'base', │ │ │ │ │ 'model', │ │ │ │ │ 'property', │ │ │ │ │ 'type', │ │ │ │ │ 'ref', │ │ │ │ │ 'source', │ │ │ │ │ 'prepare', │ │ │ │ │ ... +5 │ │ │ │ ] │ │ │ │ line = 'Sheet1:42' │ │ │ │ path = '/home/karina/work/vssa/spinta/xsds/taar_result_naujas/dsa_1293_TAAR_is… │ │ │ │ reader = <spinta.manifests.tabular.helpers.PropertyReader object at │ │ │ │ 0x7386092bdba0> │ │ │ │ Reader = <class 'spinta.manifests.tabular.helpers.PropertyReader'> │ │ │ │ rename_duplicates = False │ │ │ │ row = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'dataset': None, │ │ │ │ │ 'resource': None, │ │ │ │ │ 'base': None, │ │ │ │ │ 'model': None, │ │ │ │ │ 'property': 'extract.data[].tempdocument', │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'ref': 'Tempdocument', │ │ │ │ │ 'source': 'TEMPDOCUMENT', │ │ │ │ │ 'prepare': None, │ │ │ │ │ ... +5 │ │ │ │ } │ │ │ │ rows = <generator object _read_xlsx_manifest at 0x73860927c890> │ │ │ │ state = <spinta.manifests.tabular.helpers.State object at 0x7386092bd3c0> │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:598 in read │ │ │ │ 595 │ enums: Set[str] │ │ 596 │ │ │ 597 │ def read(self, row: Dict[str, str]) -> None: │ │ ❱ 598 │ │ full_prop, parent_prop, prop_name = _get_parent_data(self, row, row['property']) │ │ 599 │ │ prop_data = _handle_datatype(self, row) │ │ 600 │ │ if prop_data: │ │ 601 │ │ │ prop_name = _combine_parent_with_prop(prop_name, prop_data, parent_prop, ful │ │ │ │ ╭───────────────────────────────────── locals ──────────────────────────────────────╮ │ │ │ row = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'dataset': None, │ │ │ │ │ 'resource': None, │ │ │ │ │ 'base': None, │ │ │ │ │ 'model': None, │ │ │ │ │ 'property': 'extract.data[].tempdocument', │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'ref': 'Tempdocument', │ │ │ │ │ 'source': 'TEMPDOCUMENT', │ │ │ │ │ 'prepare': None, │ │ │ │ │ ... +5 │ │ │ │ } │ │ │ │ self = <spinta.manifests.tabular.helpers.PropertyReader object at 0x7386092bdba0> │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:1052 in _get_parent_data │ │ │ │ 1049 │ for i, prop in enumerate(split_props): │ │ 1050 │ │ full_name.append(prop) │ │ 1051 │ │ if '[]' in prop: │ │ ❱ 1052 │ │ │ current_parent = _get_parent_data_array(reader, given_row, '.'.join(full_nam │ │ 1053 │ │ if i + 1 != count: │ │ 1054 │ │ │ if not current_parent and full_prop: │ │ 1055 │ │ │ │ current_parent = full_prop │ │ │ │ ╭────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ count = 3 │ │ │ │ current_parent = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'type_args': [], │ │ │ │ │ 'prepare': None, │ │ │ │ │ 'level': None, │ │ │ │ │ 'access': None, │ │ │ │ │ 'uri': None, │ │ │ │ │ 'title': None, │ │ │ │ │ 'description': None, │ │ │ │ │ 'required': False, │ │ │ │ │ ... +8 │ │ │ │ } │ │ │ │ full_name = ['extract', 'data[]'] │ │ │ │ full_prop = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'type_args': [], │ │ │ │ │ 'prepare': None, │ │ │ │ │ 'level': None, │ │ │ │ │ 'access': None, │ │ │ │ │ 'uri': None, │ │ │ │ │ 'title': None, │ │ │ │ │ 'description': None, │ │ │ │ │ 'required': False, │ │ │ │ │ ... +8 │ │ │ │ } │ │ │ │ given_row = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'dataset': None, │ │ │ │ │ 'resource': None, │ │ │ │ │ 'base': None, │ │ │ │ │ 'model': None, │ │ │ │ │ 'property': 'extract.data[].tempdocument', │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'ref': 'Tempdocument', │ │ │ │ │ 'source': 'TEMPDOCUMENT', │ │ │ │ │ 'prepare': None, │ │ │ │ │ ... +5 │ │ │ │ } │ │ │ │ i = 1 │ │ │ │ name = 'extract.data[].tempdocument' │ │ │ │ prop = 'data[]' │ │ │ │ prop_name = 'extract.data[].tempdocument' │ │ │ │ reader = <spinta.manifests.tabular.helpers.PropertyReader object at 0x7386092bdba0> │ │ │ │ root = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'type_args': [], │ │ │ │ │ 'prepare': None, │ │ │ │ │ 'level': None, │ │ │ │ │ 'access': None, │ │ │ │ │ 'uri': None, │ │ │ │ │ 'title': None, │ │ │ │ │ 'description': None, │ │ │ │ │ 'required': False, │ │ │ │ │ ... +8 │ │ │ │ } │ │ │ │ split_props = ['extract', 'data[]', 'tempdocument'] │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /home/karina/work/vssa/spinta/.venv/lib/python3.10/site-packages/spinta/manifests/tabular/helper │ │ s.py:1006 in _get_parent_data_array │ │ │ │ 1003 │ │ │ current_parent = current_parent['items'] │ │ 1004 │ │ elif current_parent['type'] in ALLOWED_PARTIAL_TYPES: │ │ 1005 │ │ │ if root_name in current_parent['properties'] and current_parent['properties' │ │ ❱ 1006 │ │ │ │ raise NestedDataTypeMissmatch(initial=current_parent['type'], required=' │ │ 1007 │ │ │ elif root_name not in current_parent['properties']: │ │ 1008 │ │ │ │ current_parent['properties'][root_name] = _empty_property(_array_datatyp │ │ 1009 │ │ │ current_parent = current_parent['properties'][root_name] │ │ │ │ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │ │ │ adjustment = 0 │ │ │ │ count = 1 │ │ │ │ current_parent = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'type_args': [], │ │ │ │ │ 'prepare': None, │ │ │ │ │ 'level': None, │ │ │ │ │ 'access': None, │ │ │ │ │ 'uri': None, │ │ │ │ │ 'title': None, │ │ │ │ │ 'description': None, │ │ │ │ │ 'required': False, │ │ │ │ │ ... +8 │ │ │ │ } │ │ │ │ empty_array_row = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'dataset': None, │ │ │ │ │ 'resource': None, │ │ │ │ │ 'base': None, │ │ │ │ │ 'model': None, │ │ │ │ │ 'property': 'extract.data[]', │ │ │ │ │ 'type': 'partial_array', │ │ │ │ │ 'ref': None, │ │ │ │ │ 'source': None, │ │ │ │ │ 'prepare': None, │ │ │ │ │ ... +5 │ │ │ │ } │ │ │ │ full_name = 'extract.data[]' │ │ │ │ given_row = { │ │ │ │ │ 'id': None, │ │ │ │ │ 'dataset': None, │ │ │ │ │ 'resource': None, │ │ │ │ │ 'base': None, │ │ │ │ │ 'model': None, │ │ │ │ │ 'property': 'extract.data[].tempdocument', │ │ │ │ │ 'type': 'ref', │ │ │ │ │ 'ref': 'Tempdocument', │ │ │ │ │ 'source': 'TEMPDOCUMENT', │ │ │ │ │ 'prepare': None, │ │ │ │ │ ... +5 │ │ │ │ } │ │ │ │ i = 0 │ │ │ │ name = 'data[]' │ │ │ │ reader = <spinta.manifests.tabular.helpers.PropertyReader object at 0x7386092bdba0> │ │ │ │ root_name = 'data' │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ NestedDataTypeMissmatch: While nesting, 'ref' type cannot be cast to 'array' type. Context: initial: ref required: array