Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi,
I have a Shiny webapp that takes user inputs. I need to call a custom Python package function and pass the user inputs from the webapp and return the function value (in this case a SQL string) to the webapp. Then I need to run that SQL from the webapp and return the dataset for download to CSV.
thx
Operating system used: Windows 10
Hi @info-rchitect ,
Using python code in rshiny app is possible with packages like: https://rstudio.github.io/reticulate/
Here is a sample
library(reticulate)
use_python("/home/dataiku/dss_11/code-envs/python/py36test/bin/python")
py_run_string('
import dataiku
client = dataiku.api_client()
def update_global_var(variable_name, variable_value):
global_variables = client.get_variables()
print(global_variables)
global_variables[variable_name] = variable_value
client.set_variables(global_variables)
print(global_variables)
')
main <- import_main()
main$update_global_var(variable_name='some_variable', variable_value='some_value')
py_capture_output(main$update_global_var(variable_name='some_variable', variable_value='some_value'))
Hi @info-rchitect ,
Using python code in rshiny app is possible with packages like: https://rstudio.github.io/reticulate/
Here is a sample
library(reticulate)
use_python("/home/dataiku/dss_11/code-envs/python/py36test/bin/python")
py_run_string('
import dataiku
client = dataiku.api_client()
def update_global_var(variable_name, variable_value):
global_variables = client.get_variables()
print(global_variables)
global_variables[variable_name] = variable_value
client.set_variables(global_variables)
print(global_variables)
')
main <- import_main()
main$update_global_var(variable_name='some_variable', variable_value='some_value')
py_capture_output(main$update_global_var(variable_name='some_variable', variable_value='some_value'))
AlexT,
Have you seen any performance, scalability issues when exchanging information between R Shiny and Python? The reason I ask is because, even though I love Python, DASH in Python is much more cumbersome and less elegant than Shiny IMO. However, R sucks for the dirty work under the hood. Hence, I hope this partnership will work well, if performance is not degraded too much.
thx