{"action":"created","issue":{"url":"https://api.github.com/repos/dbohdan/sqawk/issues/8","repository_url":"https://api.github.com/repos/dbohdan/sqawk","labels_url":"https://api.github.com/repos/dbohdan/sqawk/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/dbohdan/sqawk/issues/8/comments","events_url":"https://api.github.com/repos/dbohdan/sqawk/issues/8/events","html_url":"https://github.com/dbohdan/sqawk/pull/8","id":184259180,"number":8,"title":"new option `IMPF`: importable fields","user":{"login":"sebres","id":3769657,"avatar_url":"https://avatars.githubusercontent.com/u/3769657?v=3","gravatar_id":"","url":"https://api.github.com/users/sebres","html_url":"https://github.com/sebres","followers_url":"https://api.github.com/users/sebres/followers","following_url":"https://api.github.com/users/sebres/following{/other_user}","gists_url":"https://api.github.com/users/sebres/gists{/gist_id}","starred_url":"https://api.github.com/users/sebres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebres/subscriptions","organizations_url":"https://api.github.com/users/sebres/orgs","repos_url":"https://api.github.com/users/sebres/repos","events_url":"https://api.github.com/users/sebres/events{/privacy}","received_events_url":"https://api.github.com/users/sebres/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-20T15:17:37Z","updated_at":"2016-11-29T08:50:19Z","closed_at":"2016-11-28T15:41:21Z","pull_request":{"url":"https://api.github.com/repos/dbohdan/sqawk/pulls/8","html_url":"https://github.com/dbohdan/sqawk/pull/8","diff_url":"https://github.com/dbohdan/sqawk/pull/8.diff","patch_url":"https://github.com/dbohdan/sqawk/pull/8.patch"},"body":"new option `IMPF` introduced: describes fields to be imported into the table(s), default `nr,nf,0-`), can be used to exact specifying which fields should be imported from input (increases import performance, minimizes overhead and simplifies output of statements like `select * from a`, if e. g. fields like `anr`, `anf` and `a0` are not necessary or too many input fields available).\n\nExamples:\n\n``` bash\n# with `-IMPF nr,1-2` - select anr, a1, a2 only:\necho -e \"A B C D\\nA B C\\nA B\" | sqawk -FS \" \" -IMPF nr,1-2 -output json \"select * from a\"\n\n[{\"anr\":\"1\",\"a1\":\"A\",\"a2\":\"B\"},{\"anr\":\"2\",\"a1\":\"A\",\"a2\":\"B\"},{\"anr\":\"3\",\"a1\":\"A\",\"a2\":\"B\"}]\n\n# without `-IMPF` - select anr, anf, a0 (whole record) and 10 fieds (default):\necho -e \"A B C D\\nA B C\\nA B\" | sqawk -FS \" \" -output json \"select * from a\"\n\n[{\"anr\":\"1\",\"anf\":\"5\",\"a0\":\"A B C D\",\"a1\":\"A\",\"a2\":\"B\",\"a3\":\"C\",\"a4\":\"D\",\"a5\":\"\",\"a6\":\"\",\"a7\":\"\",\"a8\":\"\",\"a9\":\"\",\"a10\":\"\"},{\"anr\":\"2\",\"anf\":\"4\",\"a0\":\"A B C\",\"a1\":\"A\",\"a2\":\"B\",\"a3\":\"C\",\"a4\":\"\",\"a5\":\"\",\"a6\":\"\",\"a7\":\"\",\"a8\":\"\",\"a9\":\"\",\"a10\":\"\"},{\"anr\":\"3\",\"anf\":\"3\",\"a0\":\"A B\",\"a1\":\"A\",\"a2\":\"B\",\"a3\":\"\",\"a4\":\"\",\"a5\":\"\",\"a6\":\"\",\"a7\":\"\",\"a8\":\"\",\"a9\":\"\",\"a10\":\"\"}]\n```\n"},"comment":{"url":"https://api.github.com/repos/dbohdan/sqawk/issues/comments/263511305","html_url":"https://github.com/dbohdan/sqawk/pull/8#issuecomment-263511305","issue_url":"https://api.github.com/repos/dbohdan/sqawk/issues/8","id":263511305,"user":{"login":"sebres","id":3769657,"avatar_url":"https://avatars.githubusercontent.com/u/3769657?v=3","gravatar_id":"","url":"https://api.github.com/users/sebres","html_url":"https://github.com/sebres","followers_url":"https://api.github.com/users/sebres/followers","following_url":"https://api.github.com/users/sebres/following{/other_user}","gists_url":"https://api.github.com/users/sebres/gists{/gist_id}","starred_url":"https://api.github.com/users/sebres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebres/subscriptions","organizations_url":"https://api.github.com/users/sebres/orgs","repos_url":"https://api.github.com/users/sebres/repos","events_url":"https://api.github.com/users/sebres/events{/privacy}","received_events_url":"https://api.github.com/users/sebres/received_events","type":"User","site_admin":false},"created_at":"2016-11-29T08:50:19Z","updated_at":"2016-11-29T08:50:19Z","body":"Well, although looks not bad, but ...\r\n\r\nPartially I don't like it, e. g.:\r\n```bash\r\necho -e \"A B C D\\nA B C\\nA B\" | sqawk -FS \" \" -output json \"select * from a\" NF=1 MNF=crop skip=3-10 F0=0\r\n[{\"anr\":\"1\",\"anf\":\"3\",\"a1\":\"A\",\"a2\":\"B\"},{\"anr\":\"2\",\"anf\":\"3\",\"a1\":\"A\",\"a2\":\"B\"},{\"anr\":\"3\",\"anf\":\"3\",\"a1\":\"A\",\"a2\":\"B\"}]\r\n```\r\nCons that I see:\r\n- negative handling (I should specify not what I'll see, but what I'll NOT see)\r\n- too wordy and too not understandable, just compare:\r\n  `NF=1 MNF=crop skip=3-10 F0=0` with suggested `-IMPF nr,1-2`\r\n- I miss the possibility to skip `anr` and `anf` (e. g. target json is strict and should not have free fields at all). And when it'll be implemented, the command line will be still longer (syntax yet wordy)...\r\n- I miss the possibility to disable all fields except 1 and 2 (something like `skip=3-`), so if we don't know how much fields in the input file (dynamical) we should write something like `skip=3-10000`\r\n\r\nOn the whole, I find my solution better (and I will continue to use it)..."}}
{"actor":{"display_login":"sebres"}}