Closed NompuK closed 5 years ago
Thanks for taking the time to file an issue, and sorry you are having trouble.
I haven't tried rquery
a lot with schema qualifications- so I probably have a defect. Sorry.
I'll try and look at this soon.
I've looked into it. The current version of rquery
(1.3.3
) is unfortunately not yet schema ready.
I have started the conversion in a development branch- but it will probably take a couple of weeks. I was able to reproduce your issue and start to code to it: but the changes are not done and currently break a few things (so switching to the branch will not fix things yet).
With luck I should have some time to fix this in the next few weeks.
The development version of rquery
(1.3.4
) now has basic schema ability. schema support varies a lot from driver to driver, and there are issues (such as not being able to create temporary tables in non-temporary schemas). Example of how to set up the enhanced connection and work with schemas is now given here.
Please be warned that we have not used rquery
in schema-mode in production yet. So there are likely to be some things that still need to be tested and extended.
Note to self: still need to schematize: rsummary()
, join_controller()
, ex_data_frame()
, rlook()
, complete_design()
, lookup_by_column()
, rstr()
, and later cdata
.
Can confirm that it works now on rquery
(1.3.4
). Good job! Looking forward to rquery
with "full" schema ability :relaxed:
rquery
is now supporting schemas to about the quality that the underlying db connection does (good on RPostgres
, okay on RPostgreSQL
). The scheme isn't so much connecting to a schema (as the connection is something supplied to rquery
, not built by rquery
), but issuing schema qualified SQL
. There are going to be some rough edges, and I'll accept issues on those.
Hi,
this is my first time writing on GitHub. I hope this is the right place for my question.
I would like to connect to a specific schema in my Postgres database.
As of today I have no clue of rquery yet, but as far as I understood I create a handle of a table inside my database via
db_td()
and then proceed. And it works when I just want to access a table in mypublic
schema.To access a table in another schema the documentation shows the
qualifiers =
argument asBut when I do this:
db_td(con, "tablename", qualifiers = c(schema = "schema"))
I get this error:
Why is this?
Inside
db_td()
is thequote_table_name()
- function, where qualifiers and tablename are put together and passed tomk_td()
.`quote_table_name(con, "tablename", qualifiers = c(schema = "schema"))
[1] "\"schema\".\"tablename\""
It works, but from there the function seems to ignore
q_table_name
. Passing the schema together with the name as "schema.tablename" doesn't work either.Maybe this is an error or I'm missunderstanding something, so my question is:
How can I connect to a specific schema in Postgres?
Thank you very much!
EDIT: On stackoverflow someone suggested the error to be in the
rq_colnames
-function atWhich seems plausible since it ignores the schema specification, but it can't be the whole story because then passing the schema with the tablename as "schema.tablename" should work.