terminusdb-tutorials icon indicating copy to clipboard operation
terminusdb-tutorials copied to clipboard

Update of Address failed (Getting Started Step 4)

Open pajoma opened this issue 3 years ago • 0 comments

Expected Behavior

Clone the repo, setup virtualenv with terminusdb_client and pandas and run the following commands (according to the guide)


$ terminusdb commit -m "update phonebook schema"
getting_started created.
getting_started schema updated.

$ terminusdb importcsv Employees.csv --classname EmployeesFromCSV --id "Employee id" -e Manager -m "Import Employees from CSV"
1it [00:00,  1.39it/s]
Records in Employees.csv inserted as type EmployeesFromCSV into database with specified ids.

$ python insert_data.py

$ terminusdb sync
Connected to getting_started.
schema.py is updated with getting_started schema.

$ python update_data.py

>> Objects should be updated

Current Behavior

Update script throws exception

$ python update_data.py

Traceback (most recent call last):
  File "C:\Users\me\Git\Python\terminusdb-tutorials\getting_started\python-client\update_data.py", line 37, in <module>
    ethan_manager = data_schema.import_objects(manager_raw)
  File "C:\Users\me\Git\Python\terminusdb-tutorials\getting_started\python-client\venv\lib\site-packages\terminusdb_client\woqlschema\woql_schema.py", line 666, in import_objects
    return self._contruct_object(obj_dict)
  File "C:\Users\me\Git\Python\terminusdb-tutorials\getting_started\python-client\venv\lib\site-packages\terminusdb_client\woqlschema\woql_schema.py", line 575, in _contruct_object
    params[key] = convert_if_object(type_dict[key], value)
  File "C:\Users\me\Git\Python\terminusdb-tutorials\getting_started\python-client\venv\lib\site-packages\terminusdb_client\woqlschema\woql_schema.py", line 557, in convert_if_object
    return self._contruct_object(value)
  File "C:\Users\me\Git\Python\terminusdb-tutorials\getting_started\python-client\venv\lib\site-packages\terminusdb_client\woqlschema\woql_schema.py", line 582, in _contruct_object
    return create_obj(type_class, obj_id, params)
  File "C:\Users\me\Git\Python\terminusdb-tutorials\getting_started\python-client\venv\lib\site-packages\terminusdb_client\woqlschema\woql_schema.py", line 517, in create_obj
    if obj._id == obj_id:
AttributeError: 'Address' object has no attribute '_id'

Context (Environment)

Versions

terminsdb_server: latest from docker hub (is there an api endpoint or client command to print the version?) terminusdb_client: 10.0.24

$ $ terminusdb alldocs --type Employee

    {
        "@id": "Employee/004",
        "@type": "Employee",
        "address": {
            "@id": "Employee/004/address/Address/64eb3c99efc273cdcfe10a4f9303e29575b8abfbe00248268cf297a79fa1f831",
            "@type": "Address",
            "postcode": "SK5 6SY",
            "street": "Ansdell Road",
            "street_num": 2,
            "town": " Stockport"
        },
        "contact_number": "(0161) 532 7302",
        "name": "Fabian Dalby",
        "team": "it",
        "title": "Web Service Manager"
    }

pajoma avatar Dec 27 '21 16:12 pajoma