Community Conundrum 25: Feature Visualization is now live! Read More

Transform a CSV into a SQL table

Level 1
Transform a CSV into a SQL table

Hi everyone,

I have created an R receipt which takes as input a dataset (which is a Big Query SQL table) and returns as output a CSV dataset, applying a model which was previously trained.

I am now trying to apply to this dataset a SQL receipt (I want to write my own SQL code), but I am not able to do so and I guess that the reason is that my dataset is not a SQL table.

Then, my question is; is there a way to write the result of the R receipt as a SQL table; if not are there any other kind of receipt which transform a csv dataset into a SQL table.

Thank you everyone for your usual support.

Kind regards,

Alessandro

0 Kudos
2 Replies
Dataiker
Dataiker

Hi, 

Did you use the builtin R output syntax? If you create a R recipe from your input dataset, for most SQL output databases the 'dkuWriteDataset' function will transform your R dataframe or data table into a SQL table...

 

library(dataiku)

# Recipe inputs
df <- dkuReadDataset("input_flow_name", samplingMethod="head", nbRows=100000)

# Compute recipe outputs from inputs
# TODO: Replace this part by your actual code that computes the output, as a R dataframe or data table

.....


# Recipe outputs
dkuWriteDataset(test,"output_flow_name")

 

 

0 Kudos
Level 1
Author

Hi Vincent,

I have actually used the built in R output format and it gives me a CSV file; however I have discovered that by using a Sync receipt it is possible to turn the CSV into a SQL table.

Thank you very much for your help.

Best regards,

Alessandro

0 Kudos
Labels (1)
  • R