Duckie

NAME

Samaki::Plugin::Duckie -- Execute SQL queries using the Duckie inline driver

DESCRIPTION

Execute SQL queries using the inline Duckie driver, which provides Raku bindings to the DuckDB C API. This runs in the same process as Samaki, making it faster than the process-based Duck plugin.

For a process-based alternative, see Samaki::Plugin::Duck.

Duckie supports user defined functions in raku via the udf's attribute. To use this, add a derived class in your config file. For example, this adds parse_poly as a UDF that converts a polyline string to GeoJSON:

use Samaki::Plugin::Duckie;
use Geo::Polyline;
use JSON::Fast;

...
/ duckie / => class Samaki::Plugin::MyDuckie is Samaki::Plugin::Duckie {
                has @.udfs = sub parse_poly (Str $poly --> Str ) {
                  to-json polyline-to-geojson( $poly, :unescape )<geometry>, :!pretty;
                };
              }
...

OPTIONS

  • db -- path to a duckdb database file. If not specified, an in-memory database is used.

EXAMPLE

-- duckie
select 'hello' as greeting, 'world' as noun;

Output (CSV):

greeting,noun
hello,world

Example with a database file:

-- duckie
| db: mydata.duckdb
select * from users limit 5;

App::samaki v0.0.33

Simple Arrangements of Modules with Any Kind of Items

Authors

  • Brian Duggan

License

MIT

Dependencies

LLM::DWIMLog::AsyncTerminal::UI:ver<0.1.13>ColorDuckie:ver<0.0.12>Prettier::TableTime::DurationTerminal::ANSIDuck::CSVColorCodeUnitMarkdown::GrammarTerminal::WCWidthHTTP::TinyTimezone::Simple

Test Dependencies

Provides

  • Samaki
  • Samaki::Cell
  • Samaki::Conf
  • Samaki::Events
  • Samaki::Exporter::HTML
  • Samaki::Importer::Jupyter
  • Samaki::Page
  • Samaki::Plugin
  • Samaki::Plugin::Auto
  • Samaki::Plugin::Bash
  • Samaki::Plugin::Code
  • Samaki::Plugin::Duck
  • Samaki::Plugin::Duckie
  • Samaki::Plugin::File
  • Samaki::Plugin::HTML
  • Samaki::Plugin::LLM
  • Samaki::Plugin::Markdown
  • Samaki::Plugin::Postgres
  • Samaki::Plugin::Process
  • Samaki::Plugin::Raku
  • Samaki::Plugin::Repl
  • Samaki::Plugin::Repl::Python
  • Samaki::Plugin::Repl::R
  • Samaki::Plugin::Repl::Raku
  • Samaki::Plugin::Text
  • Samaki::Plugin::Tmux
  • Samaki::Plugin::Tmux::Bash
  • Samaki::Plugin::Tmux::Python
  • Samaki::Plugin::URL
  • Samaki::Plugins
  • Samaki::Plugout
  • Samaki::Plugout::CSVGeo
  • Samaki::Plugout::ChartJS
  • Samaki::Plugout::Common
  • Samaki::Plugout::D3
  • Samaki::Plugout::DataTable
  • Samaki::Plugout::DeckGLBin
  • Samaki::Plugout::Duckview
  • Samaki::Plugout::Geojson
  • Samaki::Plugout::HTML
  • Samaki::Plugout::JSON
  • Samaki::Plugout::Plain
  • Samaki::Plugout::Raw
  • Samaki::Plugout::TJLess
  • Samaki::Plugouts
  • Samaki::Utils
  • Samaki::Watcher
  • sam

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.