{"action":"created","comment":{"url":"https://api.github.com/repos/ContinuumIO/into/pulls/comments/23624853","id":23624853,"diff_hunk":"@@ -0,0 +1,43 @@\n+from __future__ import absolute_import, division, print_function\n+\n+try:\n+    import sas7bdat\n+    from sas7bdat import SAS7BDAT\n+except ImportError:\n+    sas7bdat = None\n+    SAS7BDAT = type(None)\n+\n+import datashape\n+from datashape import discover, dshape, var\n+from collections import Iterator\n+import pandas as pd\n+from ..append import append\n+from ..convert import convert\n+from ..resource import resource\n+\n+\n+@resource.register('.+\\.(sas7bdat)')\n+def resource_sas(uri, **kwargs):\n+    return SAS7BDAT(uri, **kwargs)\n+\n+\n+@discover.register(SAS7BDAT)\n+def discover_sas(f, **kwargs):\n+    f.skip_header = True\n+    ln = next(f.readlines())\n+    ds = discover(ln)\n+    cols = [col.name.decode(\"utf-8\") for col in f.header.parent.columns]\n+    types = [_type.strip() for _type in str(ds).strip(\"()\").split(',')]\n+    measure = \",\".join(\" \" + col + \":\" + _type for col, _type in zip(cols, types))\n+    return var * dshape(\"{\" + measure + \"}\")\n+\n+\n+@convert.register(pd.DataFrame, SAS7BDAT, cost=4.0)\n+def sas_to_DataFrame(s, dshape=None, **kwargs):\n+    return s.to_data_frame()\n+\n+\n+@convert.register(Iterator, SAS7BDAT, cost=1.0)\n+def sas_to_iterator(s, **kwargs):\n+    s.skip_header = True","path":"into/backends/sas.py","position":42,"original_position":42,"commit_id":"4427267503322266871028c055f0e78ce71ab23c","original_commit_id":"4427267503322266871028c055f0e78ce71ab23c","user":{"login":"mrocklin","id":306380,"avatar_url":"https://avatars.githubusercontent.com/u/306380?v=3","gravatar_id":"","url":"https://api.github.com/users/mrocklin","html_url":"https://github.com/mrocklin","followers_url":"https://api.github.com/users/mrocklin/followers","following_url":"https://api.github.com/users/mrocklin/following{/other_user}","gists_url":"https://api.github.com/users/mrocklin/gists{/gist_id}","starred_url":"https://api.github.com/users/mrocklin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrocklin/subscriptions","organizations_url":"https://api.github.com/users/mrocklin/orgs","repos_url":"https://api.github.com/users/mrocklin/repos","events_url":"https://api.github.com/users/mrocklin/events{/privacy}","received_events_url":"https://api.github.com/users/mrocklin/received_events","type":"User","site_admin":false},"body":"Do we always want this?  Is there some reason why this isn't default in the `sas7bdat` library?","created_at":"2015-01-27T17:20:37Z","updated_at":"2015-01-27T17:20:37Z","html_url":"https://github.com/ContinuumIO/into/pull/41#discussion_r23624853","pull_request_url":"https://api.github.com/repos/ContinuumIO/into/pulls/41","_links":{"self":{"href":"https://api.github.com/repos/ContinuumIO/into/pulls/comments/23624853"},"html":{"href":"https://github.com/ContinuumIO/into/pull/41#discussion_r23624853"},"pull_request":{"href":"https://api.github.com/repos/ContinuumIO/into/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/ContinuumIO/into/pulls/41","id":27713778,"html_url":"https://github.com/ContinuumIO/into/pull/41","diff_url":"https://github.com/ContinuumIO/into/pull/41.diff","patch_url":"https://github.com/ContinuumIO/into/pull/41.patch","issue_url":"https://api.github.com/repos/ContinuumIO/into/issues/41","number":41,"state":"open","locked":false,"title":"SAS7BDAT backend","user":{"login":"talumbau","id":1891418,"avatar_url":"https://avatars.githubusercontent.com/u/1891418?v=3","gravatar_id":"","url":"https://api.github.com/users/talumbau","html_url":"https://github.com/talumbau","followers_url":"https://api.github.com/users/talumbau/followers","following_url":"https://api.github.com/users/talumbau/following{/other_user}","gists_url":"https://api.github.com/users/talumbau/gists{/gist_id}","starred_url":"https://api.github.com/users/talumbau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talumbau/subscriptions","organizations_url":"https://api.github.com/users/talumbau/orgs","repos_url":"https://api.github.com/users/talumbau/repos","events_url":"https://api.github.com/users/talumbau/events{/privacy}","received_events_url":"https://api.github.com/users/talumbau/received_events","type":"User","site_admin":false},"body":"Following [this](https://github.com/pydata/pandas/issues/4052) conversation, it appears that [sas7bdat](http://git.pyhacker.com/sas7bdat) now supports Python 3. This leverages the latest package, which can read compressed and uncompressed data. Some notes:\r\n\r\nSince sas7bdat doesn’t write files, I’m not sure how to do the test data, other than put it in the repo, which seems odd\r\n\r\nI don’t have a sense about cost weights. The conversions are unlikely to be a “middle step” though so it probably doesn’t matter.\r\n\r\nThis can get better if I get access to data that is more than either ‘string’ or ‘numeric’ types\r\n\r\nRenaming `sql_csv.py:excute_copy` -> `execute_copy` causes an error, so I changed it to a (hopefully) meaningful name, just not the same name as the decorator\r\n","created_at":"2015-01-20T21:27:11Z","updated_at":"2015-01-27T17:20:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82584ba42cec00e824e107e985f36d7ee9312a2e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ContinuumIO/into/pulls/41/commits","review_comments_url":"https://api.github.com/repos/ContinuumIO/into/pulls/41/comments","review_comment_url":"https://api.github.com/repos/ContinuumIO/into/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ContinuumIO/into/issues/41/comments","statuses_url":"https://api.github.com/repos/ContinuumIO/into/statuses/4427267503322266871028c055f0e78ce71ab23c","head":{"label":"talumbau:sas7bdat","ref":"sas7bdat","sha":"4427267503322266871028c055f0e78ce71ab23c","user":{"login":"talumbau","id":1891418,"avatar_url":"https://avatars.githubusercontent.com/u/1891418?v=3","gravatar_id":"","url":"https://api.github.com/users/talumbau","html_url":"https://github.com/talumbau","followers_url":"https://api.github.com/users/talumbau/followers","following_url":"https://api.github.com/users/talumbau/following{/other_user}","gists_url":"https://api.github.com/users/talumbau/gists{/gist_id}","starred_url":"https://api.github.com/users/talumbau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talumbau/subscriptions","organizations_url":"https://api.github.com/users/talumbau/orgs","repos_url":"https://api.github.com/users/talumbau/repos","events_url":"https://api.github.com/users/talumbau/events{/privacy}","received_events_url":"https://api.github.com/users/talumbau/received_events","type":"User","site_admin":false},"repo":{"id":29552663,"name":"into","full_name":"talumbau/into","owner":{"login":"talumbau","id":1891418,"avatar_url":"https://avatars.githubusercontent.com/u/1891418?v=3","gravatar_id":"","url":"https://api.github.com/users/talumbau","html_url":"https://github.com/talumbau","followers_url":"https://api.github.com/users/talumbau/followers","following_url":"https://api.github.com/users/talumbau/following{/other_user}","gists_url":"https://api.github.com/users/talumbau/gists{/gist_id}","starred_url":"https://api.github.com/users/talumbau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/talumbau/subscriptions","organizations_url":"https://api.github.com/users/talumbau/orgs","repos_url":"https://api.github.com/users/talumbau/repos","events_url":"https://api.github.com/users/talumbau/events{/privacy}","received_events_url":"https://api.github.com/users/talumbau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/talumbau/into","description":"Data Migration for Blaze Project","fork":true,"url":"https://api.github.com/repos/talumbau/into","forks_url":"https://api.github.com/repos/talumbau/into/forks","keys_url":"https://api.github.com/repos/talumbau/into/keys{/key_id}","collaborators_url":"https://api.github.com/repos/talumbau/into/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/talumbau/into/teams","hooks_url":"https://api.github.com/repos/talumbau/into/hooks","issue_events_url":"https://api.github.com/repos/talumbau/into/issues/events{/number}","events_url":"https://api.github.com/repos/talumbau/into/events","assignees_url":"https://api.github.com/repos/talumbau/into/assignees{/user}","branches_url":"https://api.github.com/repos/talumbau/into/branches{/branch}","tags_url":"https://api.github.com/repos/talumbau/into/tags","blobs_url":"https://api.github.com/repos/talumbau/into/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/talumbau/into/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/talumbau/into/git/refs{/sha}","trees_url":"https://api.github.com/repos/talumbau/into/git/trees{/sha}","statuses_url":"https://api.github.com/repos/talumbau/into/statuses/{sha}","languages_url":"https://api.github.com/repos/talumbau/into/languages","stargazers_url":"https://api.github.com/repos/talumbau/into/stargazers","contributors_url":"https://api.github.com/repos/talumbau/into/contributors","subscribers_url":"https://api.github.com/repos/talumbau/into/subscribers","subscription_url":"https://api.github.com/repos/talumbau/into/subscription","commits_url":"https://api.github.com/repos/talumbau/into/commits{/sha}","git_commits_url":"https://api.github.com/repos/talumbau/into/git/commits{/sha}","comments_url":"https://api.github.com/repos/talumbau/into/comments{/number}","issue_comment_url":"https://api.github.com/repos/talumbau/into/issues/comments/{number}","contents_url":"https://api.github.com/repos/talumbau/into/contents/{+path}","compare_url":"https://api.github.com/repos/talumbau/into/compare/{base}...{head}","merges_url":"https://api.github.com/repos/talumbau/into/merges","archive_url":"https://api.github.com/repos/talumbau/into/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/talumbau/into/downloads","issues_url":"https://api.github.com/repos/talumbau/into/issues{/number}","pulls_url":"https://api.github.com/repos/talumbau/into/pulls{/number}","milestones_url":"https://api.github.com/repos/talumbau/into/milestones{/number}","notifications_url":"https://api.github.com/repos/talumbau/into/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/talumbau/into/labels{/name}","releases_url":"https://api.github.com/repos/talumbau/into/releases{/id}","created_at":"2015-01-20T21:19:29Z","updated_at":"2015-01-20T21:19:30Z","pushed_at":"2015-01-23T08:00:09Z","git_url":"git://github.com/talumbau/into.git","ssh_url":"git@github.com:talumbau/into.git","clone_url":"https://github.com/talumbau/into.git","svn_url":"https://github.com/talumbau/into","homepage":null,"size":1160,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ContinuumIO:master","ref":"master","sha":"7b36e2ea5654610ffdd66077cdfd1d7f926467c7","user":{"login":"ContinuumIO","id":1158637,"avatar_url":"https://avatars.githubusercontent.com/u/1158637?v=3","gravatar_id":"","url":"https://api.github.com/users/ContinuumIO","html_url":"https://github.com/ContinuumIO","followers_url":"https://api.github.com/users/ContinuumIO/followers","following_url":"https://api.github.com/users/ContinuumIO/following{/other_user}","gists_url":"https://api.github.com/users/ContinuumIO/gists{/gist_id}","starred_url":"https://api.github.com/users/ContinuumIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ContinuumIO/subscriptions","organizations_url":"https://api.github.com/users/ContinuumIO/orgs","repos_url":"https://api.github.com/users/ContinuumIO/repos","events_url":"https://api.github.com/users/ContinuumIO/events{/privacy}","received_events_url":"https://api.github.com/users/ContinuumIO/received_events","type":"Organization","site_admin":false},"repo":{"id":27790033,"name":"into","full_name":"ContinuumIO/into","owner":{"login":"ContinuumIO","id":1158637,"avatar_url":"https://avatars.githubusercontent.com/u/1158637?v=3","gravatar_id":"","url":"https://api.github.com/users/ContinuumIO","html_url":"https://github.com/ContinuumIO","followers_url":"https://api.github.com/users/ContinuumIO/followers","following_url":"https://api.github.com/users/ContinuumIO/following{/other_user}","gists_url":"https://api.github.com/users/ContinuumIO/gists{/gist_id}","starred_url":"https://api.github.com/users/ContinuumIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ContinuumIO/subscriptions","organizations_url":"https://api.github.com/users/ContinuumIO/orgs","repos_url":"https://api.github.com/users/ContinuumIO/repos","events_url":"https://api.github.com/users/ContinuumIO/events{/privacy}","received_events_url":"https://api.github.com/users/ContinuumIO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ContinuumIO/into","description":"Data Migration for Blaze Project","fork":false,"url":"https://api.github.com/repos/ContinuumIO/into","forks_url":"https://api.github.com/repos/ContinuumIO/into/forks","keys_url":"https://api.github.com/repos/ContinuumIO/into/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ContinuumIO/into/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ContinuumIO/into/teams","hooks_url":"https://api.github.com/repos/ContinuumIO/into/hooks","issue_events_url":"https://api.github.com/repos/ContinuumIO/into/issues/events{/number}","events_url":"https://api.github.com/repos/ContinuumIO/into/events","assignees_url":"https://api.github.com/repos/ContinuumIO/into/assignees{/user}","branches_url":"https://api.github.com/repos/ContinuumIO/into/branches{/branch}","tags_url":"https://api.github.com/repos/ContinuumIO/into/tags","blobs_url":"https://api.github.com/repos/ContinuumIO/into/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ContinuumIO/into/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ContinuumIO/into/git/refs{/sha}","trees_url":"https://api.github.com/repos/ContinuumIO/into/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ContinuumIO/into/statuses/{sha}","languages_url":"https://api.github.com/repos/ContinuumIO/into/languages","stargazers_url":"https://api.github.com/repos/ContinuumIO/into/stargazers","contributors_url":"https://api.github.com/repos/ContinuumIO/into/contributors","subscribers_url":"https://api.github.com/repos/ContinuumIO/into/subscribers","subscription_url":"https://api.github.com/repos/ContinuumIO/into/subscription","commits_url":"https://api.github.com/repos/ContinuumIO/into/commits{/sha}","git_commits_url":"https://api.github.com/repos/ContinuumIO/into/git/commits{/sha}","comments_url":"https://api.github.com/repos/ContinuumIO/into/comments{/number}","issue_comment_url":"https://api.github.com/repos/ContinuumIO/into/issues/comments/{number}","contents_url":"https://api.github.com/repos/ContinuumIO/into/contents/{+path}","compare_url":"https://api.github.com/repos/ContinuumIO/into/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ContinuumIO/into/merges","archive_url":"https://api.github.com/repos/ContinuumIO/into/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ContinuumIO/into/downloads","issues_url":"https://api.github.com/repos/ContinuumIO/into/issues{/number}","pulls_url":"https://api.github.com/repos/ContinuumIO/into/pulls{/number}","milestones_url":"https://api.github.com/repos/ContinuumIO/into/milestones{/number}","notifications_url":"https://api.github.com/repos/ContinuumIO/into/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ContinuumIO/into/labels{/name}","releases_url":"https://api.github.com/repos/ContinuumIO/into/releases{/id}","created_at":"2014-12-09T22:17:14Z","updated_at":"2015-01-27T16:14:20Z","pushed_at":"2015-01-27T16:14:20Z","git_url":"git://github.com/ContinuumIO/into.git","ssh_url":"git@github.com:ContinuumIO/into.git","clone_url":"https://github.com/ContinuumIO/into.git","svn_url":"https://github.com/ContinuumIO/into","homepage":null,"size":2199,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":18,"forks":5,"open_issues":18,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ContinuumIO/into/pulls/41"},"html":{"href":"https://github.com/ContinuumIO/into/pull/41"},"issue":{"href":"https://api.github.com/repos/ContinuumIO/into/issues/41"},"comments":{"href":"https://api.github.com/repos/ContinuumIO/into/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/ContinuumIO/into/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/ContinuumIO/into/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ContinuumIO/into/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/ContinuumIO/into/statuses/4427267503322266871028c055f0e78ce71ab23c"}}}}