-
Notifications
You must be signed in to change notification settings - Fork 154
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Currently, when a field is renamed with steps.field_update
shouldn't other properties that rely on field.name
be updated as well? The examples that came to mind are primaryKey
and foreignKeys
(if inside a package).
Otherwise frictionless transform could take a valid resource and generate an invalid resource as output. Here's one example:
from frictionless import Resource, Pipeline, steps, Schema
source = Resource("https://raw.githubusercontent.com/frictionlessdata/framework/main/data/transform.csv")
source.schema = Schema.from_descriptor({
"fields": [
{"name": "id", "type": "integer"},
{"name": "name", "type": "string"},
{"name": "population", "type": "integer"},
],
"primaryKey": ["id"]
})
source.validate()
pipeline = Pipeline(
steps=[
steps.field_update(name="id", descriptor={"name": "pkey"}),
],
)
target = source.transform(pipeline)
target.validate()
{'valid': False,
'stats': {'tasks': 1, 'errors': 1, 'warnings': 0, 'seconds': 0.001},
'warnings': [],
'errors': [],
'tasks': [{'name': 'transform',
'type': 'table',
'valid': False,
'place': '<memory>',
'labels': [],
'stats': {'errors': 1, 'warnings': 0, 'seconds': 0.001},
'warnings': [],
'errors': [{'type': 'schema-error',
'title': 'Schema Error',
'description': 'Provided schema is not valid.',
'message': 'Schema is not valid: primary key '
'"[\'id\']" does not match the fields '
'"[\'pkey\', \'name\', \'population\']"',
'tags': [],
'note': 'primary key "[\'id\']" does not match the '
'fields "[\'pkey\', \'name\', '
'\'population\']"'}]}]}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done