iceberg 0.1.0 copy "iceberg: ^0.1.0" to clipboard
iceberg: ^0.1.0 copied to clipboard

Dart client library for the Apache Iceberg REST Catalog, used by Supabase Storage analytics buckets.

example/main.dart

// ignore_for_file: avoid_print

import 'package:iceberg/iceberg.dart';

Future<void> main() async {
  const supabaseUrl = '';
  const supabaseKey = '';
  final catalog = IcebergRestCatalog(
    baseUrl: '$supabaseUrl/storage/v1/iceberg',
    headers: {'Authorization': 'Bearer $supabaseKey'},
    warehouse: 'my-analytics-bucket',
  );

  // Create a namespace to hold the tables
  await catalog.createNamespaceIfNotExists(['analytics']);

  final namespaces = await catalog.listNamespaces();
  print('namespaces : ${namespaces.namespaces}');

  // Create a table in that namespace
  final metadata = await catalog.createTable(
    ['analytics'],
    const CreateTableRequest(
      name: 'events',
      schema: TableSchema(
        fields: [
          TableField(
            id: 1,
            name: 'id',
            type: PrimitiveType('long'),
            required: true,
          ),
          TableField(
            id: 2,
            name: 'name',
            type: PrimitiveType('string'),
            required: false,
          ),
        ],
      ),
    ),
  );
  print('table location : ${metadata.location}');

  const identifier = TableIdentifier(
    namespace: ['analytics'],
    name: 'events',
  );

  // Load the table back
  try {
    final loaded = await catalog.loadTable(identifier);
    print('metadata location : ${loaded.metadataLocation}');
  } on IcebergNotFoundException {
    print('the table does not exist');
  } on IcebergNetworkException catch (error) {
    print('no response was received : ${error.details}');
  }

  await catalog.dropTable(identifier);
  await catalog.dropNamespace(['analytics']);
}
0
likes
160
points
57
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Dart client library for the Apache Iceberg REST Catalog, used by Supabase Storage analytics buckets.

Homepage
Repository (GitHub)
View/report issues

Topics

#supabase #iceberg #analytics #storage #backend

License

MIT (license)

Dependencies

http, logging, meta, supabase_common

More

Packages that depend on iceberg