MCPcopy Index your code
hub / github.com/ankane/iceberg-ruby

github.com/ankane/iceberg-ruby @v0.11.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.11.2 ↗ · + Follow
236 symbols 557 edges 32 files 4 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Iceberg Ruby

Apache Iceberg for Ruby

:duck: Also check out SeaDuck

Build Status

Installation

Add this line to your application’s Gemfile:

gem "iceberg"

Getting Started

Create a client for an Iceberg catalog

catalog = Iceberg::RestCatalog.new(uri: "http://localhost:8181")

Create a namespace

catalog.create_namespace("main")

Create a table

catalog.create_table("main.events") do |t|
  t.bigint "id"
  t.float "value"
end

Or with Polars

df = Polars::DataFrame.new({"id" => [1, 2], "value" => [3.0, 4.0]})
table = catalog.create_table("main.events", schema: df.schema)
table.append(df)

Load a table

table = catalog.load_table("main.events")

Query a table

table.to_polars.collect

Catalog Types

REST

Iceberg::RestCatalog.new(
  uri: "http://localhost:8181"
)

SQL

Iceberg::SqlCatalog.new(
  uri: "postgres://localhost:5432/iceberg",
  warehouse: "s3://my-bucket"
)

Memory

Iceberg::MemoryCatalog.new(
  warehouse: "/tmp/warehouse"
)

Namespaces

List namespaces

catalog.list_namespaces

Create a namespace

catalog.create_namespace("main")

Check if a namespace exists

catalog.namespace_exists?("main")

Get the properties of a namespace

catalog.namespace_properties("main")

Update a namespace

catalog.update_namespace("main", properties: {})

Drop a namespace

catalog.drop_namespace("main")

Tables

List tables

catalog.list_tables("main")

Create a table

catalog.create_table("main.events") do |t|
  t.integer "id"
  t.float "value"
end

Load a table

catalog.load_table("main.events")

Check if a table exists

catalog.table_exists?("main.events")

Rename a table

catalog.rename_table("main.events", "main.events2")

Register a table

catalog.register_table("main.events", "metadata.json")

Drop a table

catalog.drop_table("main.events")

Static Tables

Load a static table

Iceberg::StaticTable.new("metadata.json")

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/iceberg-ruby.git
cd iceberg-ruby
bundle install
bundle exec rake compile

# memory catalog
bundle exec rake test:memory

# REST catalog
docker run -p 8181:8181 apache/iceberg-rest-fixture
bundle exec rake test:rest

# SQL catalog
createdb iceberg_ruby_test
bundle exec rake test:sql

Extension points exported contracts — how you extend this code

GvlExt (Interface)
(no doc) [1 implementers]
ext/iceberg/src/ruby.rs

Core symbols most depended-on inside this repo

message
called by 37
lib/iceberg.rb
create_table
called by 32
ext/iceberg/src/catalog.rs
runtime
called by 22
ext/iceberg/src/runtime.rs
as_catalog
called by 14
ext/iceberg/src/catalog.rs
table_exists?
called by 12
lib/iceberg/catalog.rb
append
called by 11
ext/iceberg/src/table.rs
list_tables
called by 8
ext/iceberg/src/catalog.rs
drop_table
called by 8
ext/iceberg/src/catalog.rs

Shape

Method 175
Class 46
Function 13
Enum 1
Interface 1

Languages

Ruby64%
Rust36%

Modules by API surface

ext/iceberg/src/table.rs38 symbols
lib/iceberg/table.rb27 symbols
ext/iceberg/src/catalog.rs23 symbols
lib/iceberg/catalog.rb17 symbols
test/test_helper.rb13 symbols
test/table_test.rb12 symbols
test/catalog_test.rb11 symbols
ext/iceberg/src/utils.rs11 symbols
test/create_table_test.rb10 symbols
lib/iceberg.rb10 symbols
test/namespace_test.rb9 symbols
test/static_table_test.rb6 symbols

Datastores touched

icebergDatabase · 1 repos
iceberg_ruby_testDatabase · 1 repos

For agents

$ claude mcp add iceberg-ruby \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact