Comments (3)
Finally I used the psql
command line tool as a workaround to access the Postgres DB from within a future
. There is some overhead obviously (open/close connection for each request), but speed is excellent and memory usage acceptable. data.table::fread
allows to read psql
output directly into a data.table (via cmd
argument). Working example: https://myweather.ch/map
Minimal example:
library(future)
library(ambiorix)
library(data.table)
plan(multisession)
app <- Ambiorix$new()
app$get("/async", function(req, res){
future({
q <- "SELECT something FROM somewhere;"
cmd <- sprintf("psql -h somehost -d somedb -U someuser -w -c %s -AF,", shQuote(q))
dat <- data.table::fread(cmd = cmd))
# Fix column types if necessary
res$send(dat)
})
})
app$start()
from ambiorix.
@m-saenger I'm sorry I never came back to you on this issue. I've setup my company last year and it left me very little time for all open-source projects.
Has this been resolved? Have you found a solution?
from ambiorix.
No worries. I found a workaround and closed this issues a couple of days ago. See #41 (comment).
from ambiorix.
Related Issues (20)
- Minify HOT 1
- Add a "strengths and weaknesses" section? HOT 2
- Support a res$send variant that doesn't convert data to character? HOT 6
- Content-Type header is overridden by send defaults (doco issue?) HOT 2
- Parse HEADERS
- Better pattern matching HOT 2
- Tests
- Mock Response & Request
- Not available from CRAN anymore ? HOT 3
- Tailwind HOT 1
- Small typo in code HOT 2
- Error handling not working HOT 2
- Pass error to handler HOT 2
- Example on `Ambiorix$start()` has a bug/typo
- error when trying to use custom websocket handler function
- Add a method to set the error handler
- `parse_multipart()` is very slow for file uploads HOT 4
- Cache templates
- bug: not able to change max body size
- Breakpoints Not Triggering in External Files When Using `box::use` in `ambiorix` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ambiorix.