{"action":"created","issue":{"url":"https://api.github.com/repos/okfn/dptools/issues/1","labels_url":"https://api.github.com/repos/okfn/dptools/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/okfn/dptools/issues/1/comments","events_url":"https://api.github.com/repos/okfn/dptools/issues/1/events","html_url":"https://github.com/okfn/dptools/issues/1","id":55663223,"number":1,"title":"Error in load-postgresql.py ?","user":{"login":"psychemedia","id":82988,"avatar_url":"https://avatars.githubusercontent.com/u/82988?v=3","gravatar_id":"","url":"https://api.github.com/users/psychemedia","html_url":"https://github.com/psychemedia","followers_url":"https://api.github.com/users/psychemedia/followers","following_url":"https://api.github.com/users/psychemedia/following{/other_user}","gists_url":"https://api.github.com/users/psychemedia/gists{/gist_id}","starred_url":"https://api.github.com/users/psychemedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychemedia/subscriptions","organizations_url":"https://api.github.com/users/psychemedia/orgs","repos_url":"https://api.github.com/users/psychemedia/repos","events_url":"https://api.github.com/users/psychemedia/events{/privacy}","received_events_url":"https://api.github.com/users/psychemedia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-27T19:30:48Z","updated_at":"2015-01-28T00:32:13Z","closed_at":null,"body":"In `load-postgresql.py`, should line 49 be:\r\n\r\n```\r\n['\\n  \"%s\" %s' % (field['name'], mappings[field['type']])\r\n                for field in fields]\r\n```\r\nrather than `field['id']`?\r\n\r\nAlso, documentation re: making the script executable:\r\n- Line 1 - add eg `#!/usr/bin/env python`\r\n- on downloading the file, make it executable: e.g. on Mac, from commandline in the same directory as the downloaded file,  `chmod ugo+x load-postgresql.py`\r\n- testing by running from the commandline: `./load-postgresql.py http://data.okfn.org/data/core/bond-yields-uk-10y/datapackage.json`\r\n\r\nBy the by, if `http://data.okfn.org/data/core/PACKAGE_NAME/` conventionally has the data package at `http://data.okfn.org/data/core/PACKAGE_NAME/datapackage.json` should the file loader be able to accept eg `http://data.okfn.org/data/core/PACKAGE_NAME` and then guess the location of the JSON file, or given eg `http://data.okfn.org/data/core/PACKAGE_NAME/foo.csv` guess at stripping `foo.csv` and then trying with `datapackage.json` using the same path?"},"comment":{"url":"https://api.github.com/repos/okfn/dptools/issues/comments/71758982","html_url":"https://github.com/okfn/dptools/issues/1#issuecomment-71758982","issue_url":"https://api.github.com/repos/okfn/dptools/issues/1","id":71758982,"user":{"login":"psychemedia","id":82988,"avatar_url":"https://avatars.githubusercontent.com/u/82988?v=3","gravatar_id":"","url":"https://api.github.com/users/psychemedia","html_url":"https://github.com/psychemedia","followers_url":"https://api.github.com/users/psychemedia/followers","following_url":"https://api.github.com/users/psychemedia/following{/other_user}","gists_url":"https://api.github.com/users/psychemedia/gists{/gist_id}","starred_url":"https://api.github.com/users/psychemedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psychemedia/subscriptions","organizations_url":"https://api.github.com/users/psychemedia/orgs","repos_url":"https://api.github.com/users/psychemedia/repos","events_url":"https://api.github.com/users/psychemedia/events{/privacy}","received_events_url":"https://api.github.com/users/psychemedia/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T00:32:13Z","updated_at":"2015-01-28T00:32:13Z","body":"I think there are actually a few more issues with the original script... eg in the example above the date field in the datapackage doesn't load properly into postgres, so there maybe needs tightening up of the whole ingest thing. I guess generating a datapackage with a set of tests for each data type that can be defined in a table would be the, erm, thorough thing to do...?\r\n\r\nMy setup also had issues with the end of line characters when I just copy and pasted the sql that was generated, so think that maybe it makes sense to generate a sql file and than test data ingest using that.\r\n\r\nI'm not really familiar with how datapackage specification has evolved in the time since the the script was written, so perhaps there are other issues too, or other elements that the script could draw on when generating the SQL?"}}