I´m trying to connect R with Netezza using the JDBC driver.
I manage to connect succesfully with the database, but the results are not corretc.
# Here ar
Based on Alex answer i wrote this function to use rtrim in all variables.
query_nzz <- function(con, select="select * ", from="", where = "", limit = " 10000; "){
options(scipen=666)
# Get variable Names
query_names = paste(select, " from ",from, where, sep = " ")
names <- dbGetQuery(con, paste(query_names,"limit 1;", sep= " "))
names <- names(names)
# Trim spaces
select <- paste0("trim(",names,") as ", names, collapse = ",")
query = paste0("select ", select, " from ", from, where, " limit ",deparse(limit),";")
data = dbGetQuery(con, query)
data
}
Function usage
dt <- query_nzz(
con,
select = "select * ",
from = "DATABASE.TABLENAME",
where = "",
limit = 100000
)