Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/label-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
"storage": "storage",
"storage_client": "storage",
"supabase_storage": "storage",
"iceberg": "storage",
"realtime": "realtime",
"realtime_client": "realtime",
"supabase_realtime": "realtime",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-pana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
fail-fast: false
matrix:
package:
- iceberg
- postgrest
- supabase
- supabase_auth
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo "Affected packages:"
echo "$CHANGED"

DART_PACKAGES="postgrest supabase supabase_auth supabase_common supabase_functions supabase_realtime supabase_storage supabase_typegen yet_another_json_isolate"
DART_PACKAGES="iceberg postgrest supabase supabase_auth supabase_common supabase_functions supabase_realtime supabase_storage supabase_typegen yet_another_json_isolate"

entries=()
for package in $DART_PACKAGES; do
Expand Down Expand Up @@ -344,7 +344,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
carryforward: 'postgrest,supabase,supabase_auth,supabase_common,supabase_functions,supabase_realtime,supabase_storage,supabase_typegen,yet_another_json_isolate,supabase_flutter'
carryforward: 'iceberg,postgrest,supabase,supabase_auth,supabase_common,supabase_functions,supabase_realtime,supabase_storage,supabase_typegen,yet_another_json_isolate,supabase_flutter'
fail-on-error: false

test-result:
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The repository follows a layered dependency structure:
- **postgrest**: Database query client with ORM-style API
- **supabase_realtime**: WebSocket client for real-time subscriptions
- **supabase_storage**: File storage client with retry logic
- **iceberg**: Apache Iceberg REST Catalog client used by storage analytics buckets
- **supabase_functions**: Edge functions invocation client
- **yet_another_json_isolate**: JSON parsing in separate isolate for performance

Expand Down
21 changes: 20 additions & 1 deletion MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ versions of the Supabase Flutter SDK, together with the steps required to migrat

All packages in this repository are released together for a major version, so a single section
covers `supabase_flutter`, `supabase`, `supabase_auth`, `postgrest`, `supabase_realtime`,
`supabase_storage` and `supabase_functions`. Every symbol mentioned here is re-exported from
`supabase_storage`, `iceberg` and `supabase_functions`. Every symbol mentioned here is re-exported from
`supabase_flutter`, so the snippets apply whether you depend on the individual package or on the
Flutter one.

Expand Down Expand Up @@ -973,6 +973,25 @@ try {
Exhaustive switches over the sealed hierarchy still compile with the same set of cases, since the
new base is sealed and every concrete subtype is unchanged.

### The Iceberg catalog moved to its own package

`IcebergRestCatalog`, the exceptions above and the table and namespace types now live in
`iceberg`, mirroring the split between `storage-js` and `iceberg-js`. `supabase_storage`
depends on it and re-exports the whole surface, so importing
`package:supabase_storage/supabase_storage.dart` or `package:supabase_flutter/supabase_flutter.dart`
keeps working unchanged, and `storage.analyticsCatalog()` is still how you get a catalog for an
analytics bucket.

Depend on `iceberg` directly to talk to an Iceberg REST Catalog without the rest of Storage:

```dart
final catalog = IcebergRestCatalog(
baseUrl: 'https://example.com/iceberg',
headers: {'Authorization': 'Bearer $token'},
warehouse: 'my-warehouse',
);
```
Comment thread
spydon marked this conversation as resolved.

### Abbreviations in the public API are spelled out

Public identifiers that still used abbreviations are spelled out, continuing the precedent set by
Expand Down
3 changes: 3 additions & 0 deletions packages/iceberg/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0

- Initial release. Apache Iceberg REST Catalog client extracted from storage_client.
21 changes: 21 additions & 0 deletions packages/iceberg/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Supabase

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions packages/iceberg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<br />
<p align="center">
<a href="https://supabase.com">
<img alt="Supabase Logo" width="300" src="https://raw.githubusercontent.com/supabase/supabase/master/packages/common/assets/images/logo-preview.jpg">
</a>

<h1 align="center">iceberg</h1>

<p align="center">
Dart client library for the <a href="https://iceberg.apache.org/rest-catalog-spec/">Apache Iceberg REST Catalog</a>.
</p>

<p align="center">
<a href="https://supabase.com/docs/guides/storage/analytics/introduction">Guides</a>
</p>
</p>

<div align="center">

[![pub package](https://img.shields.io/pub/v/iceberg.svg)](https://pub.dev/packages/iceberg)
[![pub test](https://github.com/supabase/supabase-flutter/workflows/Test/badge.svg)](https://github.com/supabase/supabase-flutter/actions?query=workflow%3ATest)

</div>

## Usage

Against a Supabase analytics bucket, get a catalog from `StorageClient` instead
of constructing one yourself:

```dart
final catalog = supabase.storage.analyticsCatalog('my-analytics-bucket');
await catalog.createNamespace(['my_namespace']);
```

Against any other Iceberg REST Catalog, point the client at its base URL:

```dart
final catalog = IcebergRestCatalog(
baseUrl: 'https://example.com/iceberg',
warehouse: 'my-warehouse',
headers: {'Authorization': 'Bearer $token'},
);
```

## Docs

The docs can be found on the official Supabase website.

- [Analytics buckets guide](https://supabase.com/docs/guides/storage/analytics/introduction)

## License

This repo is licensed under MIT.

## Credits

- https://github.com/supabase/iceberg-js - ported from supabase/iceberg-js
11 changes: 11 additions & 0 deletions packages/iceberg/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include: package:supabase_lints/analysis_options.yaml

analyzer:
exclude:
- build/**
- android/**
- ios/**
- web/**
- windows/**
- macos/**
- linux/**
62 changes: 62 additions & 0 deletions packages/iceberg/example/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// 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']);
}
11 changes: 11 additions & 0 deletions packages/iceberg/lib/iceberg.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/// Dart client library for the Apache Iceberg REST Catalog.
library;

export 'package:supabase_common/supabase_common.dart'
show SupabaseApiException, SupabaseException;

export 'src/iceberg_error.dart';
export 'src/iceberg_rest_catalog.dart';
export 'src/iceberg_types.dart';
export 'src/table_requirement.dart';
export 'src/table_update.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dart:convert';
import 'dart:math';

import 'package:http/http.dart' as http;
import 'package:iceberg/src/iceberg_error.dart';
import 'package:iceberg/src/iceberg_types.dart';
import 'package:iceberg/src/table_requirement.dart';
import 'package:iceberg/src/table_update.dart';
import 'package:logging/logging.dart';
import 'package:supabase_storage/src/iceberg/iceberg_error.dart';
import 'package:supabase_storage/src/iceberg/iceberg_types.dart';
import 'package:supabase_storage/src/iceberg/table_requirement.dart';
import 'package:supabase_storage/src/iceberg/table_update.dart';
import 'package:supabase_common/supabase_common.dart';

class _IcebergResponse {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:supabase_storage/src/iceberg/iceberg_types.dart';
import 'package:iceberg/src/iceberg_types.dart';

/// A single change applied to a table as part of a commit. The common data
/// definition updates are modelled as dedicated subclasses. Updates that are
Expand Down
30 changes: 30 additions & 0 deletions packages/iceberg/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: iceberg
description: Dart client library for the Apache Iceberg REST Catalog, used by Supabase Storage analytics buckets.
version: 0.1.0
homepage: 'https://supabase.com'
repository: 'https://github.com/supabase/supabase-flutter/tree/main/packages/iceberg'
issue_tracker: 'https://github.com/supabase/supabase-flutter/issues'
documentation: 'https://supabase.com/docs/guides/storage/analytics/introduction'
topics:
- supabase
- iceberg
- analytics
- storage
- backend

environment:
sdk: '>=3.9.0 <4.0.0'

resolution: workspace

dependencies:
http: ^1.6.0
logging: ^1.3.0
supabase_common: 0.1.2

dev_dependencies:
test: ^1.25.0
supabase_lints: ^0.1.1

false_secrets:
- /test/**
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:convert';
import 'dart:io';

import 'package:http/http.dart';
import 'package:supabase_storage/supabase_storage.dart';
import 'package:iceberg/iceberg.dart';
import 'package:test/test.dart';

const String supabaseUrl = 'SUPABASE_TEST_URL';
Expand Down
5 changes: 2 additions & 3 deletions packages/supabase_storage/lib/src/storage_client.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import 'package:iceberg/iceberg.dart';
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:supabase_common/supabase_common.dart';
import 'package:supabase_storage/src/storage_constants.dart';
import 'package:supabase_storage/src/iceberg/iceberg_rest_catalog.dart';
import 'package:supabase_storage/src/iceberg/iceberg_types.dart';
import 'package:supabase_storage/src/storage_bucket_api.dart';
import 'package:supabase_storage/src/storage_file_api.dart';
import 'package:supabase_storage/src/vector_client.dart';
import 'package:supabase_storage/src/version.dart';
import 'package:supabase_common/supabase_common.dart';

class SupabaseStorageClient extends StorageBucketApi {
final int _defaultRetryAttempts;
Expand Down
6 changes: 1 addition & 5 deletions packages/supabase_storage/lib/supabase_storage.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/// Dart client library for Supabase Storage.
library;

export 'package:iceberg/iceberg.dart';
export 'package:supabase_common/supabase_common.dart'
show SupabaseApiException, SupabaseException;

export 'src/iceberg/iceberg_error.dart';
export 'src/iceberg/iceberg_rest_catalog.dart';
export 'src/iceberg/iceberg_types.dart';
export 'src/iceberg/table_requirement.dart';
export 'src/iceberg/table_update.dart';
export 'src/storage_client.dart';
export 'src/storage_file_api.dart';
export 'src/types.dart';
Expand Down
1 change: 1 addition & 0 deletions packages/supabase_storage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ resolution: workspace

dependencies:
http: ^1.6.0
iceberg: 0.1.0
mime: '>=2.0.0 <3.0.0'
meta: ^1.16.0
logging: ^1.3.0
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ environment:

workspace:
- packages/supabase_functions
- packages/iceberg
- packages/supabase_auth
- packages/postgrest
- packages/supabase_realtime
Expand Down