Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linkml2sheets doesn't work when given a directory of templates #69

Closed
turbomam opened this issue Aug 17, 2022 · 3 comments
Closed

linkml2sheets doesn't work when given a directory of templates #69

turbomam opened this issue Aug 17, 2022 · 3 comments
Assignees

Comments

@turbomam
Copy link
Contributor

@putmantime and I have observed that running linkml2sheets on a directory of templates doesn't work, even when all of the individual templates do work

the linkml2sheets help gives this example:

linkml2sheets -s my_schema.yaml sheets/*.tsv -d sheets --overwrite

In the nmdc-schema repo, the following two work

schemasheets/tsv_output/slots.tsv: clean_schemasheets
	linkml2sheets \
		--schema src/schema/nmdc.yaml \
		--output-directory schemasheets/tsv_output/ \
		schemasheets/templates/slots.tsv

schemasheets/tsv_output/classes.tsv: clean_schemasheets
	linkml2sheets \
		--schema src/schema/nmdc.yaml \
		--output-directory schemasheets/tsv_output/ \
		schemasheets/templates/classes.tsv

but this doesn't work

schemasheets/tsv_output/all.tsv: clean_schemasheets
	linkml2sheets \
		--schema src/schema/nmdc.yaml \
		--output-directory schemasheets/tsv_output/ \
		schemasheets/templates/*.tsv

Even though

ls -l schemasheets/templates 

-rw-r--r--@ 1 MAM staff 71 Aug 16 17:22 classes.tsv
-rw-r--r--@ 1 MAM staff 58 Aug 16 17:26 prefixes.tsv
-rw-r--r--@ 1 MAM staff 2005 Aug 16 18:01 slots.tsv

The error is

Traceback (most recent call last):
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/bin/linkml2sheets", line 8, in
sys.exit(export_schema())
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/lib/python3.9/site-packages/schemasheets/schema_exporter.py", line 297, in export_schema
exporter.export(sv, specification=f, to_file=outpath)
File "/Users/MAM/Library/Caches/pypoetry/virtualenvs/nmdc-schema-MTtWF7zd-py3.9/lib/python3.9/site-packages/schemasheets/schema_exporter.py", line 90, in export
writer.writerow(row)
File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/csv.py", line 154, in writerow
return self.writer.writerow(self._dict_to_list(rowdict))
File "/usr/local/Cellar/python@3.9/3.9.13_2/Frameworks/Python.framework/Versions/3.9/lib/python3.9/csv.py", line 149, in _dict_to_list
raise ValueError("dict contains fields not in fieldnames: "
ValueError: dict contains fields not in fieldnames: 'class'
make: *** [schemasheets/tsv_output/all.tsv] Error 1

@cmungall
Copy link
Member

Are you sure this is different from:

what output do you get if the prefixes tsv is not in the directory?

@sierra-moxon
Copy link
Member

closing as a duplicate of #70.

@turbomam
Copy link
Contributor Author

I think they are different issues and will write tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants