dbc

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

README

dbc dbc Logo

License GitHub release (latest SemVer) Release dbc

dbc is the command-line tool for installing and managing ADBC drivers.

Install dbc

Shell (Linux/macOS)
curl -LsSf https://dbc.columnar.tech/install.sh | sh
Homebrew
brew install columnar-tech/tap/dbc
uv
uv tool install dbc
pipx
pipx install dbc
PowerShell (Windows)
powershell -ExecutionPolicy ByPass -c irm https://dbc.columnar.tech/install.ps1 | iex
WinGet
winget install dbc
Windows MSI

Download the MSI installer

For more installation options, see the installation docs.

Getting Started

Search for available drivers:

dbc search

Install a driver:

dbc install snowflake

Use it with Python:

pip install "adbc-driver-manager>=1.8.0"
import adbc_driver_manager.dbapi as adbc

with adbc.connect(
    driver="snowflake",
    db_kwargs={
        "username": "USER",
        "password": "PASS",
        "adbc.snowflake.sql.account": "ACCOUNT-IDENT",
        # ... other connection options
    },
) as con, con.cursor() as cursor:
    cursor.execute("SELECT * FROM CUSTOMER LIMIT 5")
    print(cursor.fetch_arrow_table())

You can also manage drivers in a project using a driver list. And you can store connection options in a connection profile instead of in your code.

For more details, see the dbc documentation and the ADBC Quickstarts.

Communications

Code of Conduct

By contributing to dbc, you agree to follow our Code of Conduct.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized         = errors.New("not authorized")
	ErrUnauthorizedColumnar = errors.New("not authorized to access")
)
View Source
var (
	Version = "unknown"

	// DefaultClient is the HTTP client used for all requests.
	//
	// Deprecated: Use NewClient with WithHTTPClient instead.
	// DefaultClient must be set during program initialization,
	// before any concurrent calls to GetDriverList or makereq.
	DefaultClient = http.DefaultClient
)

Functions

func SignedByColumnar deprecated

func SignedByColumnar(lib, sig io.Reader) error

Deprecated: Signature verification is now handled internally by Client.Install. SignedByColumnar returns nil if the library was signed by the columnar public key (embedded in the CLI) or an error otherwise.

Types

type Client added in v0.3.0

type Client struct {
	// contains filtered or unexported fields
}

Client is a dbc client for searching registries and managing ADBC drivers.

func NewClient added in v0.3.0

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new driver registry client with the given options.

func (*Client) CreateManifest added in v0.3.0

func (c *Client) CreateManifest(cfg config.Config, di config.DriverInfo) error

CreateManifest creates a manifest file for the given driver configuration.

func (*Client) Download added in v0.3.0

func (c *Client) Download(ctx context.Context, pkg PkgInfo) (io.ReadCloser, error)

Download fetches the tarball for pkg and returns its contents as an io.ReadCloser. The caller is responsible for closing the returned body. Auth credentials are resolved and injected automatically, including token refresh on 401.

func (*Client) GetConfig added in v0.3.0

func (c *Client) GetConfig(level config.ConfigLevel) config.Config

GetConfig returns the configuration at the specified level.

func (*Client) GetDriver added in v0.3.0

func (c *Client) GetDriver(cfg config.Config, name string) (config.DriverInfo, error)

GetDriver retrieves driver information from the given configuration.

func (*Client) HTTPClient added in v0.3.0

func (c *Client) HTTPClient() *http.Client

func (*Client) Install added in v0.3.0

func (c *Client) Install(ctx context.Context, cfg config.Config, driverName string) (*config.Manifest, error)

Install installs a driver with the given name to the specified configuration.

func (*Client) ListInstalled added in v0.3.0

func (c *Client) ListInstalled(level config.ConfigLevel) []config.DriverInfo

ListInstalled returns a list of installed drivers at the specified configuration level.

func (*Client) Login added in v0.3.0

func (c *Client) Login(cred *auth.Credential) error

Login saves a credential for the given registry.

func (*Client) Logout added in v0.3.0

func (c *Client) Logout(registryURL *url.URL) error

Logout removes the credential for the given registry URL.

func (*Client) Registries added in v0.3.0

func (c *Client) Registries() []Registry

Registries returns the list of driver registries configured for this client.

func (*Client) Search added in v0.3.0

func (c *Client) Search(ctx context.Context, pattern string) ([]Driver, error)

Search searches for drivers matching the given pattern across all registries.

func (*Client) Uninstall added in v0.3.0

func (c *Client) Uninstall(cfg config.Config, driverName string) error

Uninstall uninstalls a driver with the given name from the specified configuration.

func (*Client) UserAgent added in v0.3.0

func (c *Client) UserAgent() string

UserAgent returns the user agent string used by this client.

type Driver

type Driver struct {
	Registry *Registry `yaml:"-"`

	Title   string    `yaml:"name"`
	Desc    string    `yaml:"description"`
	License string    `yaml:"license"`
	Path    string    `yaml:"path"`
	URLs    []string  `yaml:"urls"`
	DocsURL string    `yaml:"docs_url"`
	PkgInfo []pkginfo `yaml:"pkginfo"`
}

func GetDriverList deprecated

func GetDriverList() ([]Driver, error)

GetDriverList returns a list of all available drivers from all configured registries.

Deprecated: Use NewClient and Client.Search instead.

func (Driver) AllVersions added in v0.3.0

func (d Driver) AllVersions() []VersionInfo

AllVersions returns all version/package entries for the driver as exported VersionInfo values. This allows callers outside the dbc package to iterate over every version and platform without needing access to the unexported pkginfo type.

func (Driver) GetPackage

func (d Driver) GetPackage(version *semver.Version, platformTuple string, allowPrerelease bool) (PkgInfo, error)

func (Driver) GetWithConstraint

func (d Driver) GetWithConstraint(c *semver.Constraints, platformTuple string) (PkgInfo, error)

func (Driver) HasNonPrerelease added in v0.2.0

func (d Driver) HasNonPrerelease() bool

func (Driver) MaxVersion

func (d Driver) MaxVersion() (VersionInfo, bool)

func (Driver) Versions

func (d Driver) Versions(platformTuple string) semver.Collection

type Option added in v0.3.0

type Option func(*clientConfig)

func WithAuthFromFilesystem added in v0.3.0

func WithAuthFromFilesystem() Option

WithAuthFromFilesystem configures the client to read credentials from the filesystem.

func WithBaseURL added in v0.3.0

func WithBaseURL(u string) Option

WithBaseURL sets the base URL for the driver registry.

func WithCredential added in v0.3.0

func WithCredential(cred *auth.Credential) Option

WithCredential sets a specific credential to use for all requests.

func WithHTTPClient added in v0.3.0

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient sets the HTTP client to use for requests.

func WithRegistries added in v0.3.0

func WithRegistries(r []Registry) Option

WithRegistries sets the driver registries to use.

func WithUserAgent added in v0.3.0

func WithUserAgent(ua string) Option

WithUserAgent sets the user agent string for requests. This only takes effect when no custom HTTP client is provided via WithHTTPClient; if a custom client is supplied its transport is used as-is.

type PackageInfo added in v0.3.0

type PackageInfo struct {
	Platform string
	URL      string
}

PackageInfo holds the platform and raw URL string for a single package entry. The URL may be relative (joined against the registry base URL) or absolute.

type PkgInfo

type PkgInfo struct {
	Driver        Driver
	Version       *semver.Version
	PlatformTuple string

	Path *url.URL
}

func (PkgInfo) DownloadPackage deprecated

func (p PkgInfo) DownloadPackage(prog ProgressFunc) (*os.File, error)

Deprecated: Use Client.Download instead.

type ProgressFunc

type ProgressFunc func(written, total int64)

type Registry added in v0.2.0

type Registry struct {
	Name    string
	Drivers []Driver
	BaseURL *url.URL
}

type VersionInfo added in v0.3.0

type VersionInfo struct {
	Version  *semver.Version
	Packages []PackageInfo
}

VersionInfo holds the version and its associated packages for a driver.

Directories

Path Synopsis
cmd
dbc command
fslock
Package fslock provides advisory file locking for coordinating exclusive access to shared resources across processes.
Package fslock provides advisory file locking for coordinating exclusive access to shared resources across processes.
jsonschema
Package jsonschema defines the versioned JSON output schema for the dbc CLI.
Package jsonschema defines the versioned JSON output schema for the dbc CLI.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL