| 1 | package DBIO::DuckDB; | ||
| 2 | 1 | our $VERSION = '0.900001'; | |
| 3 | |||
| 4 | |||
| 5 | # ABSTRACT: DuckDB-specific schema management for DBIO | ||
| 6 | |||
| 7 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | ▶ | use base 'DBIO::Base'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | |||
| 13 | 0 | ▶ | sub connection { |
|
Subroutine
connection: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 14 | 0 | my ($self, @info) = @_; | |
| 15 | 0 | $self->storage_type('+DBIO::DuckDB::Storage'); | |
| 16 | 0 | return $self->next::method(@info); | |
| 17 | } | ||
| 18 | |||
| 19 | 1 | 1; | |
| 20 | |||
| 21 | __END__ | ||
| 22 | |||
| 23 | =pod | ||
| 24 | |||
| 25 | =encoding UTF-8 | ||
| 26 | |||
| 27 | =head1 NAME | ||
| 28 | |||
| 29 | DBIO::DuckDB - DuckDB-specific schema management for DBIO | ||
| 30 | |||
| 31 | =head1 VERSION | ||
| 32 | |||
| 33 | version 0.900001 | ||
| 34 | |||
| 35 | =head1 SYNOPSIS | ||
| 36 | |||
| 37 | package MyApp::Schema; | ||
| 38 | use base 'DBIO::Schema'; | ||
| 39 | __PACKAGE__->load_components('DuckDB'); | ||
| 40 | |||
| 41 | my $schema = MyApp::Schema->connect('dbi:DuckDB:dbname=app.duckdb'); | ||
| 42 | |||
| 43 | # or, using the `-du` shortcut: | ||
| 44 | package MyApp::Schema; | ||
| 45 | use DBIO Schema => -du; | ||
| 46 | |||
| 47 | =head1 DESCRIPTION | ||
| 48 | |||
| 49 | L<DBIO::DuckDB> is the DuckDB driver component for DBIO. When loaded into | ||
| 50 | a schema class, C<connection()> sets L<DBIO::Schema/storage_type> to | ||
| 51 | C<+DBIO::DuckDB::Storage>, which enables DuckDB-specific storage behavior. | ||
| 52 | |||
| 53 | The driver is built on top of L<DBD::DuckDB> (which itself is a pure-FFI | ||
| 54 | DBI driver -- no XS compile, only C<libduckdb> at runtime). DuckDB is an | ||
| 55 | embedded, synchronous, columnar analytical database. This driver keeps | ||
| 56 | the DBI plumbing for all the boring ORM work (transactions, bind, cursor, | ||
| 57 | ResultSet) and exposes the interesting DuckDB-native features as direct | ||
| 58 | methods on the storage object: | ||
| 59 | |||
| 60 | =over 4 | ||
| 61 | |||
| 62 | =item * L<DBIO::DuckDB::Storage/duckdb_appender> -- bulk insert via the | ||
| 63 | DuckDB Appender API | ||
| 64 | |||
| 65 | =item * L<DBIO::DuckDB::Storage/duckdb_arrow_fetch> -- columnar fetch | ||
| 66 | path (reserved for Arrow integration) | ||
| 67 | |||
| 68 | =item * L<DBIO::DuckDB::Storage/duckdb_read_csv>, | ||
| 69 | L<DBIO::DuckDB::Storage/duckdb_read_parquet>, | ||
| 70 | L<DBIO::DuckDB::Storage/duckdb_read_json> -- table-function helpers | ||
| 71 | |||
| 72 | =back | ||
| 73 | |||
| 74 | Schema management (install/diff/upgrade) uses the native | ||
| 75 | test-deploy-and-compare strategy via L<DBIO::DuckDB::Deploy>. | ||
| 76 | |||
| 77 | =head1 METHODS | ||
| 78 | |||
| 79 | =head2 connection | ||
| 80 | |||
| 81 | Overrides L<DBIO/connection> to force C<+DBIO::DuckDB::Storage> as | ||
| 82 | C<storage_type>. | ||
| 83 | |||
| 84 | =head1 TESTING | ||
| 85 | |||
| 86 | Tests use in-memory DuckDB databases and do not require external | ||
| 87 | credentials. The C<t/> directory contains user-level smoke scripts | ||
| 88 | (not automated TAP tests) for manually verifying the driver end-to-end | ||
| 89 | against a real libduckdb install. | ||
| 90 | |||
| 91 | =head1 AUTHOR | ||
| 92 | |||
| 93 | DBIO Authors | ||
| 94 | |||
| 95 | =head1 COPYRIGHT AND LICENSE | ||
| 96 | |||
| 97 | Copyright (C) 2026 DBIO Authors | ||
| 98 | |||
| 99 | This is free software; you can redistribute it and/or modify it under | ||
| 100 | the same terms as the Perl 5 programming language system itself. | ||
| 101 | |||
| 102 | =cut | ||