Skip to content

Commit

Permalink
DuckDB compose file
Browse files Browse the repository at this point in the history
  • Loading branch information
aavanesy committed Feb 2, 2024
1 parent b016fd5 commit b46147a
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 13 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ By launching an R container linked to the respective database container, we can
- `Oracle`: developed by Oracle.
- `PostgreSQL`: developed by PostgreSQL Global Development Group, open-source.
- `SQLite`: developed by D. Richard Hipp, open-source, file-based, and designed to be embedded into applications.
- `DuckDB`: developed by the CWI Database Architectures group, open-source.

### R Images for testing purposes

Expand All @@ -48,6 +49,12 @@ By launching an R container linked to the respective database container, we can
```
docker pull ghcr.io/krlmlr/rdb/r-sqlite:latest
```
- `r-duckdb` with the necessary packages and libraries to test connections to an DuckDB database.
```
docker pull ghcr.io/krlmlr/rdb/r-duckdb:latest
```
R images are based on [rig-ubuntu](https://github.com/cynkra/rig-ubuntu/pkgs/container/rig-ubuntu), built daily at midnight UTC.
Expand Down Expand Up @@ -137,4 +144,16 @@ Stop Containers
docker-compose -f compose_files/docker-compose.sqlite.yml down #--volumes
```

##
### DuckDB Database & R

Start Containers

``` r
docker-compose -f compose_files/docker-compose.duckdb.yml run rdb_duckdb
```

Stop Containers

``` r
docker-compose -f compose_files/docker-compose.duckdb.yml down #--volumes
```
22 changes: 22 additions & 0 deletions compose_files/docker-compose.duckdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

version: '3'
volumes:
duckdb-db:
driver: local

services:

# -- DUCKDB SERVICE --

rdb_duckdb:
container_name: rdb_duckdb
image: ghcr.io/krlmlr/rdb/r-duckdb
platform: linux/amd64
tty: true
stdin_open: true
volumes:
# simple test
- ./test/test-duckdb.R:/root/workspace/.Rprofile
entrypoint: ["R"]


24 changes: 12 additions & 12 deletions compose_files/docker-compose.sqlite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ services:
container_name: rdb_sqlite
image: ghcr.io/krlmlr/rdb/r-sqlite
platform: linux/amd64
depends_on:
- sqlite
# depends_on:
# - sqlite
tty: true
stdin_open: true
volumes:
# simple test
- ./test/test-sqlite.R:/root/workspace/.Rprofile
entrypoint: ["R"]

sqlite:
container_name: sqlite
#https://github.com/KEINOS/Dockerfile_of_SQLite3 - built weekly
image: keinos/sqlite3:latest
volumes:
- ./data:/data
working_dir: /data
command: sqlite3
stdin_open: true
tty: true
# sqlite:
# container_name: sqlite
# #https://github.com/KEINOS/Dockerfile_of_SQLite3 - built weekly
# image: keinos/sqlite3:latest
# volumes:
# - ./data:/data
# working_dir: /data
# command: sqlite3
# stdin_open: true
# tty: true

14 changes: 14 additions & 0 deletions compose_files/test/test-duckdb.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# simple test script

print('Simple Test of DUCKDB Connectivity')

con <- try(DBI::dbConnect(duckdb::duckdb(), ":memory:"), silent = T)

if(class(con) == "try-error"){
print('Incorrect Setup.')
}else{
print(con)
print('Connection Correctly Configured.')
}

0 comments on commit b46147a

Please sign in to comment.