Skip to content

Python Getting-Started Tutorial fails in step 4 (incorrect type) #91

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

Closed
apacha opened this issue Mar 6, 2023 · 1 comment
Closed

Python Getting-Started Tutorial fails in step 4 (incorrect type) #91

apacha opened this issue Mar 6, 2023 · 1 comment

Comments

@apacha
Copy link

apacha commented Mar 6, 2023

This issue probably relates to #22. I've tried the Python tutorial and when running the code for Step 4, the execution fails when calling import_objects, because the previous call returns everything as type string:

Screenshot 2023-03-06 at 14 05 58

which leads to a crash with this error message:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/alex/Repositories/TerminusDbPlayground/update_data.py", line 17, in <module>
    destiny = data_schema.import_objects(destiny_raw)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 705, in import_objects
    return self._construct_object(obj_dict)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 613, in _construct_object
    params[key] = convert_if_object(type_dict[key], value)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 595, in convert_if_object
    return self._construct_object(value)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 620, in _construct_object
    return create_obj(type_class, obj_id, params)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 561, in create_obj
    new_obj.__init__(new_obj, **params)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 142, in init
    setattr(obj, key, value)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 193, in __setattr__
    _check_mismatch_type(name, value, correct_type)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/terminusdb_client/schema/schema.py", line 70, in _check_mismatch_type
    check_type(prop, prop_value, prop_type)
  File "/Users/alex/Repositories/TerminusDbPlayground/venv/lib/python3.9/site-packages/typeguard/__init__.py", line 785, in check_type
    raise TypeError(
TypeError: type of street_num must be int; got str instead
python-BaseException

In the database, the type is correctly set as integer:

Screenshot 2023-03-06 at 14 07 59
Screenshot 2023-03-06 at 14 07 18

I'm not sure if I did something wrong in the tutorial, or whether something in the system is not working as intended.

Debug information:

  • Python 3.9
  • Terminusdb-client 10.2.0
  • DB from Docker (terminusdb.docker.scarf.sh/terminusdb/terminusdb-server) image (Image ID d1de6df881c9).

Running ./terminusdb-container cli from TerminusDB Bootstrap also fails with the message unknown shorthand flag: 'i' in -i

@GavinMendelGleason
Copy link
Member

Good catch! This was due to changes in TerminusDB 11 which represents big numbers with strings to support a broader range of languages (as well as GraphQL) but we missed this bit in the Python Client. We've made a patch to the Python Client and we are releasing v10.2.1 with the fix.

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

2 participants