Drop #560 (2024-11-22): Quack • Post • Code

duckdb-api; bsky.rss; Learn Deno

In today’s Drop we’ve got a technical exploration of DuckDB’s API capabilities, a way to turn an RSS feed into ATproto posts, and Deno 2.x educational resources.


TL;DR

(This is an AI-generated summary of today’s Drop using Ollama + llama 3.2 and a custom prompt.)


duckdb-api

Photo by Pixabay on Pexels.com

(I promise this is not turning into a DuckDB blog.)

The duckdb-api project provides a containerized solution for running DuckDB with a Hono.js API frontend. This implementation exposes DuckDB’s functionality through two primary HTTP endpoints that accept SQL queries: a JSON-based query endpoint and an Arrow streaming endpoint.

The API runs in a Docker container and listens on port 3000 by default. It supports basic authentication through environment variables and can also integrate with any AWS S3 for data access (I may be PR’ing into it to support AWS S3-compatible stores as well).

The /query endpoint accepts POST requests and returns results in JSON format, while /streaming-query streams results using Apache Arrow. Both endpoints expect a JSON request body containing a query property with the SQL statement to execute.

The service can be configured through several environment variables:

  • PORT— API listening port (defaults to 3000)
  • USERNAME/PASSWORD— Basic auth credentials
  • AWS_REGION — S3 region
  • AWS_ACCESS_KEY_ID — S3 access key
  • AWS_SECRET_ACCESS_KEY — S3 secret key

The API can handle both simple queries and complex operations against remote data sources. Here’s a practical example that queries a remote Parquet file:

curl --location 'localhost:3000/streaming-query' \
--header 'Content-Type: application/json' \
--data '{
  "query": "SELECT * FROM '\''https://shell.duckdb.org/data/tpch/0_01/parquet/orders.parquet'\'' LIMIT 100"
}' \
--output /tmp/result.arrow

This can be a quick/handy way to expose your JSON/Parquet/etc. collection, especially over Tailscale/WireGuard.


bsky.rss

Photo by Tove Liu on Pexels.com

(I also promise that this is not becoming just a Bluesky/ATproto tech blog.)

Since Bluesky continues to be having a moment…

bsky.rss is a configurable RSS posting system for Bluesky that can be deployed via Docker or manual installation. The system enables automated posting of RSS feed content to Bluesky accounts with extensive customization options.

The provided Docker deployment uses a straightforward compose configuration that requires environment variables for authentication and RSS feed configuration. The setup does need a mounted volume for persistent configuration storage.

For those preferring direct control, the manual installation process involves cloning the repository and using yarn for dependency management.

The system operates through two primary configuration mechanisms.

Critical operational parameters are controlled through environment variables, including:

  • APP_PASSWORD for authentication
  • INSTANCE_URL for Bluesky instance specification
  • FETCH_URL for RSS feed source
  • IDENTIFIER for account identification

The config.json file controls posting behavior with granular options for content formatting and presentation. The configuration supports post templating using variables like $title and $link, along with embed controls for rich media presentation.

bsky.rss includes sophisticated content handling capabilities. Posts can be published with OpenGraph cards or direct image embeds, with configurable truncation for oversized content. Language tagging supports ISO 639-1 codes, and the system includes HTML cleaning capabilities for both titles and descriptions.

Content deduplication can be handled either through date-based tracking or a text-based database approach. The posting interval is configurable, with a recommended 60-second default to ensure reliable feed monitoring. And, it even has considerations for ensuring attachments have alt-text.

This is probably one of the easiest ways to self-host a “feed” for Bsky.


Learn Deno

I’m really liking Deno 2.x and have been cranking out a few internal and external mini-apps with it over the past ~month. It may be one of the best ways to write portable R web and CLI applications, since WebR seems to work pretty well with it, now (there were some initial compatibility issues WASM-wise).

If you don’t know JavaScript super-well (most folks know at least enough JS to be a tad dangerous), and have never taken the Deno plunge, they’ve got a great and accessible Deno 2 course that will walk you through the basics and Deno ecosystem. The videos are short, and their examples are concise. For example, Chapter 13 builds a small RESTful API with Deno 2 and Hono in just 63 lines of TypeScript.

One big reason (besides being able to compile JS/TS apps to a binary) I like Deno is their focus on safety. Despite thousands of snippets across the internet only showing how to “allow everything”, you can get very granular with the permission structures in Deno.

During these short, dark days in my Hemisphere, having something to focus on helps get through bouts of seasonal affective disorder (SAD). And, what’s more, you may just have fun!


FIN

We all will need to get much, much better at sensitive comms, and Signal is one of the only ways to do that in modern times. You should absolutely use that if you are doing any kind of community organizing (etc.). Ping me on Mastodon or Bluesky with a “🦇?” request (public or faux-private) and I’ll provide a one-time use link to connect us on Signal.

Remember, you can follow and interact with the full text of The Daily Drop’s free posts on Mastodon via @dailydrop.hrbrmstr.dev@dailydrop.hrbrmstr.dev ☮️