question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I'm having some trouble validating a package with primary/foreign key relations - I get the following:

See original GitHub issue

I’m having some trouble validating a package with primary/foreign key relations - I get the following:

{
    "version": "4.1.0",
    "time": 0.036,
    "errors": [
        {
            "code": "task-error",
            "name": "Task Error",
            "tags": [],
            "note": "'str' object has no attribute 'keys'",
            "message": "The task has an error: 'str' object has no attribute 'keys'",
            "description": "General task-level error."
        }
    ],
    "tasks": [],
    "stats": {
        "errors": 1,
        "tasks": 0
    },
    "valid": false
}

Primary keys and foreign keys seem to be defined ok and I’m at a loss to know what this error means.

The package follows a basic star schema and if I remove the FK relations on the main data table resource the package validates fine. I’ve copied the FK definition which appears at the end of the table resource (I’ve tried the fields both with and without an array - the documentation is a bit confusing, but the result re the error is the same):

"foreignKeys": [
          {
            "fields": [
              "crop_type"
            ],
            "reference": {
              "resource": "crop_types_data",
              "fields": [
                "crop_name"
              ]
            }
          },
          {
            "fields": [
              "liming_factor_level"
            ],
            "reference": {
              "resource": "liming_factor_data",
              "fields": [
                "factor_level_name"
              ]
            }
          },
          {
            "fields": [
              "p_factor_level"
            ],
            "reference": {
              "resource": "p_factor_data",
              "fields": [
                "factor_level_name"
              ]
            }
          },
          {
            "fields": [
              "k_factor_level"
            ],
            "reference": {
              "resource": "k_factor_data",
              "fields": [
                "factor_level_name"
              ]
            }
          }
        ]

Any idea why this is happening?

_Originally posted by @sapetti9 in https://github.com/frictionlessdata/project/discussions/623_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
richardostlercommented, Mar 22, 2021

@roll I’ve attached the main data file and a couple of related files - its just a subset of the data as this is to accompany a journal article which hasn’t yet been published.

crop_types_data.csv.txt grain_data.csv.txt mn_factor_data.csv.txt

0reactions
rollcommented, Mar 23, 2021

I’ve improved the error message in frictionless@4.2.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when validating a package with primary/foreign key ...
I'm having some trouble validating a package with primary/foreign key relations - I get the following: { "version": "4.1.0", "time": 0.036, ...
Read more >
3 common foreign key mistakes (and how to avoid them)
1. Mismatched data types ... When you're using a foreign key to reference a column in another table, the datatypes of both tables...
Read more >
ENABLE NOVALIDATE validating existing data - Ask TOM
This is what i am doing:SQL> create table t (a number, constraint uniq_a ... if the primary key is enabled novalidate - then...
Read more >
What's wrong with foreign keys? - Stack Overflow
Reasons to use Foreign Keys: you won't get Orphaned Rows; you can get nice "on delete cascade" behavior, automatically cleaning up tables; knowing...
Read more >
The following unsupported foreign key relationships are ...
I would like to start using Memory-Optimized Tables in my OLTP database. I am using Memory Optimization Advisor and getting the following error....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found