{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/dplyr/issues/945","labels_url":"https://api.github.com/repos/hadley/dplyr/issues/945/labels{/name}","comments_url":"https://api.github.com/repos/hadley/dplyr/issues/945/comments","events_url":"https://api.github.com/repos/hadley/dplyr/issues/945/events","html_url":"https://github.com/hadley/dplyr/issues/945","id":56547897,"number":945,"title":"names() not working properly with database tbl()","user":{"login":"dalejbarr","id":3208529,"avatar_url":"https://avatars.githubusercontent.com/u/3208529?v=3","gravatar_id":"","url":"https://api.github.com/users/dalejbarr","html_url":"https://github.com/dalejbarr","followers_url":"https://api.github.com/users/dalejbarr/followers","following_url":"https://api.github.com/users/dalejbarr/following{/other_user}","gists_url":"https://api.github.com/users/dalejbarr/gists{/gist_id}","starred_url":"https://api.github.com/users/dalejbarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalejbarr/subscriptions","organizations_url":"https://api.github.com/users/dalejbarr/orgs","repos_url":"https://api.github.com/users/dalejbarr/repos","events_url":"https://api.github.com/users/dalejbarr/events{/privacy}","received_events_url":"https://api.github.com/users/dalejbarr/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-04T16:13:01Z","updated_at":"2015-02-04T17:22:04Z","closed_at":"2015-02-04T16:42:08Z","body":"It looks like the `names()` function is not returning the field names with tables from database connections, e.g., with `tbl()`.\r\n\r\nI have confirmed this behavior for dplyr_0.4.1.9000 and with SQLite and MySQL connections\r\n\r\n```r\r\n### create a temporary sqlite database                                                                               \r\ncon <- src_sqlite(\"temp.db\", create = TRUE)\r\ntest_df\t<- data_frame(A=1:2, B=3:4)\r\ncopy_to(con, test_df, \"test_df\")\r\n\r\n### desired behavior\r\nnames(test_df)\r\n###  [1] \"A\" \"B\"\r\n\r\n### doesn't work with tbl()\r\nnames(tbl(con, \"test_df\"))\r\n### [1] \"src\"       \"from\"      \"select\"    \"summarise\" \"mutate\"    \"where\"                                        \r\n### [7] \"group_by\"  \"order_by\"  \"query\"                                                                            \r\n\r\n### but works after collect\r\nnames(tbl(con, \"test\") %>% collect())                                                         \r\n### [1] \"A\" \"B\" \r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/hadley/dplyr/issues/comments/72897391","html_url":"https://github.com/hadley/dplyr/issues/945#issuecomment-72897391","issue_url":"https://api.github.com/repos/hadley/dplyr/issues/945","id":72897391,"user":{"login":"dalejbarr","id":3208529,"avatar_url":"https://avatars.githubusercontent.com/u/3208529?v=3","gravatar_id":"","url":"https://api.github.com/users/dalejbarr","html_url":"https://github.com/dalejbarr","followers_url":"https://api.github.com/users/dalejbarr/followers","following_url":"https://api.github.com/users/dalejbarr/following{/other_user}","gists_url":"https://api.github.com/users/dalejbarr/gists{/gist_id}","starred_url":"https://api.github.com/users/dalejbarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalejbarr/subscriptions","organizations_url":"https://api.github.com/users/dalejbarr/orgs","repos_url":"https://api.github.com/users/dalejbarr/repos","events_url":"https://api.github.com/users/dalejbarr/events{/privacy}","received_events_url":"https://api.github.com/users/dalejbarr/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T17:22:04Z","updated_at":"2015-02-04T17:22:04Z","body":"Thanks for the response! Adding names() to my list of \"habits of base R I need to unlearn because of dplyr\" :)"}}