Skip to content

Use package_revise instead of resource_create #28

@paulmueller

Description

@paulmueller

Affected code:

# Attempt upload
e = MultipartEncoder(fields={
'package_id': dataset_id,
'name': resource_name,
'upload': (resource_name, path.open('rb'))})
m = MultipartEncoderMonitor(e, monitor_callback)
# perform upload
data = api.post("resource_create",
data=m,
dump_json=False,
headers={"Content-Type": m.content_type})

Using package_revise instead of resource_create was @wardi's suggestion in the ckan gitter.im chat. package_revise can be used with the __extend syntax to support file uploads.

The original problem were race conditions when resources were added and at the same time package_revise was called from other threads. package_revise should be atomic if and only if only package_revise is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions