35#include <unordered_map>
38#include "iceberg/catalog/sql/iceberg_sql_catalog_export.h"
39#include "iceberg/result.h"
41namespace iceberg::sql {
48 std::optional<std::string>
value;
58 int32_t max_connections = 1;
91 std::string_view ns) = 0;
103 std::optional<std::string_view> value) = 0;
122 virtual Result<std::vector<std::string>>
ListTableNames(std::string_view ns) = 0;
129 virtual Result<bool>
TableExists(std::string_view ns, std::string_view name) = 0;
138 std::string_view ns, std::string_view name) = 0;
149 virtual Status
InsertTable(std::string_view ns, std::string_view name,
150 std::string_view metadata_location) = 0;
164 std::string_view ns, std::string_view name, std::string_view new_location,
165 std::string_view new_previous_location,
166 std::string_view expected_current_location) = 0;
173 virtual Result<int64_t>
DeleteTable(std::string_view ns, std::string_view name) = 0;
186 std::string_view from_name, std::string_view to_ns,
187 std::string_view to_name) = 0;
219ICEBERG_SQL_CATALOG_EXPORT Result<std::shared_ptr<CatalogStore>>
ICEBERG_SQL_CATALOG_EXPORT Result< std::shared_ptr< CatalogStore > > MakeMySqlCatalogStore(const CatalogStoreOptions &options)
Build the built-in MySQL catalog store (sqlpp23 + libmysqlclient).
Definition catalog_store_mysql.cc:67
ICEBERG_SQL_CATALOG_EXPORT Result< std::shared_ptr< CatalogStore > > MakePostgreSqlCatalogStore(const CatalogStoreOptions &options)
Build the built-in PostgreSQL catalog store (sqlpp23 + libpq).
Definition catalog_store_postgresql.cc:61
ICEBERG_SQL_CATALOG_EXPORT Result< std::shared_ptr< CatalogStore > > MakeSqliteCatalogStore(const CatalogStoreOptions &options)
Build the built-in SQLite catalog store (sqlpp23 + SQLite3).
Definition catalog_store_sqlite3.cc:64
Semantic, driver-agnostic storage interface for the SQL catalog.
Definition catalog_store.h:72
virtual Result< std::optional< std::string > > GetTableMetadataLocation(std::string_view ns, std::string_view name)=0
Return the current metadata location of (ns, name).
virtual Result< int64_t > DeleteTable(std::string_view ns, std::string_view name)=0
Delete the table row (ns, name), if present.
virtual Result< int64_t > RenameTable(std::string_view from_ns, std::string_view from_name, std::string_view to_ns, std::string_view to_name)=0
Move a table row to a new namespace and/or name.
virtual Status InsertTable(std::string_view ns, std::string_view name, std::string_view metadata_location)=0
Insert a new table row with the given metadata location.
virtual Result< int64_t > UpdateTableMetadataLocation(std::string_view ns, std::string_view name, std::string_view new_location, std::string_view new_previous_location, std::string_view expected_current_location)=0
Conditionally update a table's metadata location (optimistic CAS).
virtual Status DeleteNamespaceProperty(std::string_view ns, std::string_view key)=0
Delete the property row identified by (ns, key), if present.
virtual Result< std::vector< NamespaceProperty > > GetNamespaceProperties(std::string_view ns)=0
Return all property rows stored for ns.
virtual Result< int64_t > DeleteNamespace(std::string_view ns)=0
Delete all property rows for ns.
virtual Status InsertNamespaceProperty(std::string_view ns, std::string_view key, std::optional< std::string_view > value)=0
Insert one property row for ns.
virtual Result< bool > TableExists(std::string_view ns, std::string_view name)=0
Whether a row exists for the table (ns, name).
virtual Status RunInTransaction(const std::function< Status()> &body)=0
Execute body atomically inside a single transaction.
virtual Result< std::vector< std::string > > ListTableNames(std::string_view ns)=0
Return the table names stored directly under ns.
virtual Status Initialize()=0
Create the backing tables if they do not already exist.
virtual Result< std::vector< std::string > > ListNamespaceNames()=0
Return the distinct namespace identifiers known to this catalog.
Connection parameters used to construct a built-in CatalogStore.
Definition catalog_store.h:52
std::string uri
Connector-specific connection string.
Definition catalog_store.h:56
std::string catalog_name
Logical catalog name used to scope rows.
Definition catalog_store.h:54
std::unordered_map< std::string, std::string > properties
Additional connector-specific properties.
Definition catalog_store.h:60
A namespace property row.
Definition catalog_store.h:44
std::optional< std::string > value
Property value, or std::nullopt for SQL NULL.
Definition catalog_store.h:48
std::string key
Property key.
Definition catalog_store.h:46