Add DataPackage.push method
See original GitHub issueI can load Data Packages via URLs from data.okfn.org (e.g. http://data.okfn.org/data/core/cpi/datapackage.json) or from within the working directory (e.g. “.”). I am having trouble, though, loading directly from GitHub (‘https://raw.githubusercontent.com/datasets/cpi/master/datapackage.json’) or anywhere else on the filesystem.
In my case, loading works well:
import datapackage
dp = datapackage.DataPackage('https://raw.githubusercontent.com/datasets/cpi/master/datapackage.json')
But when I try to push to e.g. an SQL database using:
push_datapackage(descriptor=dp.metadata,backend='sql',engine=engine)
I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/dan/open_knowledge/envs/tutorial/lib/python3.5/site-packages/datapackage/pushpull.py", line 53, in push_datapackage
data = resource.iter()
File "/Users/dan/open_knowledge/envs/tutorial/lib/python3.5/site-packages/datapackage/resource.py", line 297, in iter
raise IOError('Resource\'s data couldn\'t be loaded.')
OSError: Resource's data couldn't be loaded.
For the above example of loading from https://raw.githubusercontent.com/datasets/cpi/master/datapackage.json, it seems to be trying to load directly from non-existent “data/cpi.csv” in the working directory and not “https://raw.githubusercontent.com/datasets/cpi/master/data/cpi.csv”
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (9 by maintainers)
Top Results From Across the Web
Push elements in a list or vector in datapackage.r - Rdrr.io
Helper function to add components in a list or vector.
Read more >Push (Tabular) Data Package to AWS Redshift · Issue #128 ... - GitHub
Push (Tabular) Data Package to AWS Redshift #128. Closed ... Add DataPackage.push method frictionlessdata/datapackage-py#75. Closed.
Read more >datapackage - npm
A class for working with data resources. You can read or iterate tabular resources using the iter/read methods and all resource as bytes...
Read more >Using Data Packages in Python
Short examples of pushing your dataset to Google's BigQuery and Amazon's RedShift ... For this tutorial, we will need the main Python Data...
Read more >File: README — Documentation for datapackage (1.1.1)
Validating data packages to ensure they conform with the Data Package specification. Installation. Add the gem into your Gemfile: gem 'datapackage.rb'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rgrp Just to add to what @roll said, the problem here is that @danfowler was passing
dp.metadata
, which is just a dict. There’s no indication of where it came from. However, theDataPackage
instance itself knows its base path and can calculate relative paths for the resources, which is why I think thepush_datapackage
andpull_datapackage
needs to live inside theDataPackage
class.I think this is a weak point of the current design. The push and pull datapackage methods don’t fit with the rest of the code structure yet. Ideally, this should work: