https://slingdata.io logo
BoilStream - A Streaming LakeHouse
# sling-help
c
I was perusing the DuckDb community extensions list and came across https://boilstream.com/ ([blog intro](https://docs.boilstream.com/blog/posts/introducing-boilstream.html) ) - looks like a great system. I was wondering if anyone had tried streaming data to BoilStream uisng Sling? For example, you can insert data from DuckDb like [this](https://docs.boilstream.com/api/flight-rpc.html#duckdb-airport-extension):
Copy code
-- Install and load Airport extension
INSTALL airport FROM community;
LOAD airport;

-- Connect to BoilStream
ATTACH 'boilstream' AS bs (
    TYPE AIRPORT,
    location 'grpc://localhost:50051/'
);

-- Stream data to BoilStream
COPY (SELECT * FROM my_table) 
TO 'bs://topic_name';
But that requires an intermediate step. BoilStream supports Arrow Flight gRPC and (also over HTTP) so it seems that could be another approach, although I assume that would require a new connector. I'm not yet a BoilStream user, but it's looking very enticing and direct support in Sling could be a great way to load data into it.
Looking at https://docs.slingdata.io/examples/sling-python it seems that using the Sling class to read from a source into an arrow stream is trivial, then writing that to BoilStream could be pretty straightforward. Would that method automatically handle incremental state? It seems you'd need to be able to inform the state storage whether not a stream read was successful or not so I'm guessing you need to handle state yourself?
f
hey @Colin pretty cool, didn't know about boilstream. There is a similar concept on the roadmap for the [sling platform](https://docs.slingdata.io/sling-platform/platform), where you ingest via api, and the platform agent would route into the respective table. For boistream, I think a simple post hook in you replication would work, no?:
Copy code
source: my_db
target: duckdb

hooks:
  start:
     - type: query
       connection: duckdb
       query: |
          -- Connect to BoilStream
          ATTACH 'boilstream' AS bs (
              TYPE AIRPORT,
              location 'grpc://localhost:50051/'
          );

defaults:
  hooks:
    post:
       - type: query
         connection: duckdb
         transient: false # so we use the existing connection
         query: |
            -- Stream data to BoilStream
            COPY (SELECT * FROM {run.object.full_name}) 
            TO 'bs://topic_name';
using the arrow input, you could do that. or you could actually just output to arrow with stdout and do it in duckdb as you wish:
Copy code
sling --src-conn mysql --src-stream ... --tgt-options '{ format: arrow }'  --stdout | duckdb ...
Something similar in python with the
Sling
class could work:
Copy code
reader = Sling(src_conn='mysql',src_stream='my_table').stream_arrow()

# use reader to pipe into duckdb
Although, I'm curious, what would you use boilstream for? duckdb can write directly to s3 and partition.
c
Definitely has a lot of overlap with DuckLake now as far as storage format, but it supports multiple ingestion connections, whereas I think using DuckDb alone I'd have to work with a single writer thread at a time. Also provides a Postgres connection interface for querying and full-local replica, etc. Still investigating. Potentially looking to use Sling to provide initial replication then switch to CDC. Thanks for the tip about hooks, I didn't think to try that!