### DuckDB Initialization Script Example Source: https://harlequin.sh/docs/duckdb/initialization An example of a DuckDB initialization script that installs and loads extensions, sets configurations, and opens a database file. ```sql INSTALL httpfs; LOAD httpfs; SET s3_region='us-west-2'; .open './my-database.db' ``` -------------------------------- ### Run Harlequin with DuckDB Source: https://harlequin.sh/docs/getting-started/running Examples of running Harlequin with the default DuckDB adapter. This includes starting an in-memory session and connecting to DuckDB database files. ```shell $ harlequin ``` ```shell $ harlequin "path/to/duck.db" "another_duck.db" ``` -------------------------------- ### Install Harlequin with postgres adapter using uv Source: https://harlequin.sh/docs/getting-started Installs Harlequin along with the postgres adapter using uv extras. ```shell $ uv tool install 'harlequin[postgres]' ``` -------------------------------- ### Install Harlequin with multiple adapters using uv (alternative shell syntax) Source: https://harlequin.sh/docs/getting-started Installs Harlequin with multiple database adapters using uv extras, demonstrating alternative shell quoting. ```shell % uv tool install 'harlequin[postgres,mysql,s3]' ``` -------------------------------- ### Run Harlequin with SQLite Source: https://harlequin.sh/docs/getting-started/running Examples of running Harlequin with the SQLite adapter. This includes starting an in-memory session and connecting to SQLite database files using the --adapter or -a option. ```shell $ harlequin --adapter sqlite ``` ```shell $ harlequin -a sqlite "path/to/sqlite.db" "another_sqlite.db" ``` -------------------------------- ### Install Harlequin with specific adapter using uv --with Source: https://harlequin.sh/docs/getting-started Installs Harlequin and a specific adapter (harlequin-odbc) manually using uv's --with option. ```shell $ uv tool install harlequin --with harlequin-odbc ``` -------------------------------- ### Install Harlequin with multiple adapters using uv Source: https://harlequin.sh/docs/getting-started Installs Harlequin with multiple database adapters (postgres, mysql, s3) using uv extras. ```shell $ uv tool install 'harlequin[postgres,mysql,s3]' ``` -------------------------------- ### Install Harlequin with uv Source: https://harlequin.sh/docs/getting-started Installs Harlequin as a tool into an isolated environment using uv, adding it to the system's PATH. ```shell $ uv tool install harlequin ``` -------------------------------- ### Install Harlequin with ODBC support using uv Source: https://harlequin.sh/docs/odbc/index Installs the Harlequin package with the 'odbc' extra, which includes the necessary dependencies for the ODBC adapter. This is the recommended installation method. ```bash uv tool install 'harlequin[odbc]' ``` -------------------------------- ### Install Harlequin with RisingWave Adapter using uv Source: https://harlequin.sh/docs/risingwave Installs the harlequin-risingwave package into the same environment as Harlequin using the uv package manager. This is the recommended method for setting up the adapter. ```bash uv tool install harlequin --with harlequin-risingwave ``` -------------------------------- ### Install Harlequin with Databricks Support Source: https://harlequin.sh/docs/databricks/index Installs the Harlequin package with the Databricks extra using the 'uv' package installer. This is the recommended method for setting up Harlequin for Databricks. ```bash $ uv tool install 'harlequin[databricks]' ``` -------------------------------- ### Install uv using PowerShell Source: https://harlequin.sh/docs/getting-started Installs the uv tool using a PowerShell script. This method is suitable for Windows environments. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install Harlequin with pip Source: https://harlequin.sh/docs/getting-started Installs Harlequin from PyPI using pip. This method requires Python 3.9 or above. ```shell $ pip install harlequin ``` -------------------------------- ### Install Harlequin with Exasol Adapter Source: https://harlequin.sh/docs/exasol Installs the Harlequin application along with the Exasol adapter using the 'uv' package manager. This command ensures both Harlequin and its Exasol integration are set up in the same environment. ```bash uv tool install harlequin --with 'harlequin-exasol' ``` -------------------------------- ### Load Multiple DuckDB Extensions via CLI Source: https://harlequin.sh/docs/duckdb/extensions This command demonstrates how to install and load multiple standard DuckDB extensions (e.g., 'spatial', 'httpfs') when starting Harlequin using the `-e` flag. ```bash harlequin -e spatial -e httpfs ``` -------------------------------- ### Install Harlequin with NebulaGraph Adapter Source: https://harlequin.sh/docs/nebulagraph Installs the Harlequin NebulaGraph adapter package alongside Harlequin using the `uv` package manager. Ensure Harlequin is already installed or install them together. ```bash $ uv tool install harlequin --with harlequin-nebulagraph ``` -------------------------------- ### Databricks Initialization Script Example Source: https://harlequin.sh/docs/databricks/initialization Example of SQL commands that can be included in a Databricks initialization script for Harlequin. Multi-line SQL statements must be terminated by a semicolon. ```sql USE CATALOG my_catalog; SET TIME ZONE 'Asia/Tokyo'; DECLARE yesterday DATE DEFAULT CURRENT_DATE - INTERVAL '1' DAY; ``` -------------------------------- ### Install Harlequin with Homebrew Source: https://harlequin.sh/docs/getting-started Installs Harlequin using the Homebrew package manager. This formula includes adapter packages and their dependencies. ```shell $ brew install harlequin ``` -------------------------------- ### Install uv using curl Source: https://harlequin.sh/docs/getting-started Installs the uv tool using a shell script fetched via curl. This is a POSIX-compliant method. ```shell $ curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install Harlequin with ADBC and Snowflake Driver Source: https://harlequin.sh/docs/adbc Installs the Harlequin package with ADBC support and the ADBC Snowflake driver using `uv`. ```bash $ uv tool install 'harlequin[adbc]' --with adbc-driver-snowflake ``` -------------------------------- ### Install Project Dependencies with Poetry Source: https://harlequin.sh/docs/contributing/index Installs the Harlequin project in editable mode along with all its dependencies, including those for testing and development. This command is essential for setting up the project environment. ```bash poetry install --sync ``` -------------------------------- ### Install Harlequin with Cassandra Extra Source: https://harlequin.sh/docs/cassandra Installs the Harlequin package along with the Cassandra extra dependencies using the `uv` tool. This ensures that the necessary components for the Cassandra adapter are available in the same environment. ```shell $ uv tool install 'harlequin[cassandra]' ``` -------------------------------- ### Install Harlequin with BigQuery Extra using uv Source: https://harlequin.sh/docs/bigquery/index Installs the Harlequin package with the BigQuery extra dependencies using the `uv` package installer. This ensures all necessary components for BigQuery integration are included. ```bash $ uv tool install 'harlequin[bigquery]' ``` -------------------------------- ### Enable Truecolor in Terminal (Bash Example) Source: https://harlequin.sh/docs/troubleshooting/appearance Sets the COLORTERM environment variable to 'truecolor' to instruct the terminal to render colors in truecolor mode. This is a common fix for 256-color limitations. This example shows how to add it to your .bashrc file for persistent use. ```shell export COLORTERM=truecolor ``` -------------------------------- ### Start Harlequin Source: https://harlequin.sh/docs/getting-started/usage Launches Harlequin with an in-memory DuckDB database. This is the basic command to open the application in terminal mode. ```bash harlequin ``` -------------------------------- ### Install Harlequin with MySQL Extra Source: https://harlequin.sh/docs/mysql/index Installs the `harlequin-mysql` package and Harlequin itself into the current environment using `uv`. This command ensures the MySQL adapter is available for use with Harlequin. ```bash $ uv tool install 'harlequin[mysql]' ``` -------------------------------- ### Connect to Exasol using Harlequin Source: https://harlequin.sh/docs/exasol Demonstrates how to connect to an Exasol database using the Harlequin CLI. It includes specifying the adapter ('exasol'), schema, host, and port, as well as an example for connecting to a Dockerized Exasol instance with disabled certificate validation. ```bash harlequin -a exasol --schema 'foo' --host '8.9.10.1' --port 8563 ... ``` ```bash harlequin -a exasol --disable-certificate-validation ``` -------------------------------- ### DuckDB Transaction Example Source: https://harlequin.sh/docs/duckdb/transactions Demonstrates explicit transaction handling in DuckDB. It shows creating a table (auto-committed), starting a transaction, inserting data and committing, and starting another transaction, inserting data, then rolling back. Finally, it selects all data from the person table. ```sql CREATE TABLE person (name VARCHAR, age BIGINT); -- auto-committed BEGIN TRANSACTION; INSERT INTO person VALUES ('Ada', 52); COMMIT; BEGIN TRANSACTION; DELETE FROM person WHERE name = 'Ada'; INSERT INTO person VALUES ('Bruce', 39); ROLLBACK; SELECT * FROM person; ``` -------------------------------- ### Run Harlequin with BigQuery Adapter Source: https://harlequin.sh/docs/bigquery/index Launches Harlequin connected to BigQuery, specifying the adapter, Google Cloud project ID, and the desired BigQuery location. The `project` and `location` options are mandatory for BigQuery connections. ```bash $ harlequin -a bigquery --project my-gcp-project --location us-west1 ``` -------------------------------- ### Start Harlequin with Wherobots (API Key) Source: https://harlequin.sh/docs/wherobots Launches Harlequin and connects to WherobotsDB using an API key for authentication. ```shell $ harlequin -a wherobots --api-key ``` -------------------------------- ### Example Harlequin TOML Configuration Source: https://harlequin.sh/docs/config-file/creating-config An example of a TOML configuration file for Harlequin. It demonstrates defining a default profile and specific profiles for different databases like DuckDB and PostgreSQL, including various connection and display options. ```toml default_profile = "my-duckdb-profile" [profiles.my-duckdb-profile] limit = 200_000 adapter = "duckdb" conn_str = ["my-database.db"] read_only = true extension = ["httpfs", "spatial"] init_path = "~/.duckdbrc" [profiles.local-postgres] theme = "gruvbox" limit = 10_000 adapter = "postgres" host = "localhost" user = "postgres" password = "secretadminpassword" dbname = "postgres" port = 5432 ``` -------------------------------- ### Install Harlequin with Wherobots Adapter Source: https://harlequin.sh/docs/wherobots Installs the Harlequin package along with the harlequin-wherobots adapter using the uv tool. Ensures both packages are in the same environment. ```shell $ uv tool install harlequin --with harlequin-wherobots ``` -------------------------------- ### Start Harlequin with Wherobots (Token) Source: https://harlequin.sh/docs/wherobots Launches Harlequin and connects to WherobotsDB using a session token for authentication. ```shell $ harlequin -a wherobots --token ``` -------------------------------- ### Adding Harlequin Adapter as an Optional Extra with Poetry Source: https://harlequin.sh/docs/contributing/adapter-guide Shows how to configure an adapter to be installable as an optional extra with Harlequin using Poetry. This involves defining an optional dependency for the adapter's distribution package and then including it in the `[tool.poetry.extras]` section. ```toml [tool.poetry.dependencies] ... my-adapter-pypi-distribution = { version = ">=0.1", optional = true } ... [tool.poetry.extras] ... my-adapter = ["my-adapter-pypi-distribution"] ... ``` -------------------------------- ### Install Harlequin with Trino Extra using uv Source: https://harlequin.sh/docs/trino Installs the 'harlequin[trino]' package using the 'uv' tool. This ensures the Trino adapter is installed in the same environment as Harlequin. ```shell $ uv tool install 'harlequin[trino]' ``` -------------------------------- ### Configure Harlequin Databricks Initialization Script Path Source: https://harlequin.sh/docs/databricks/initialization Command-line example showing how to specify a custom path for the Databricks initialization script using the --init-path option in Harlequin. ```bash harlequin -a databricks --init-path /path/to/my/script.sql ``` -------------------------------- ### Example Harlequin Configuration in pyproject.toml Source: https://harlequin.sh/docs/config-file/creating-config Shows how to configure Harlequin within a `pyproject.toml` file by nesting the configuration under the `tool.harlequin` table. This approach is useful for projects that already use `pyproject.toml` for managing build and project settings. ```toml [tool.harlequin] default_profile = "my-duckdb-profile" [tool.harlequin.profiles.my-duckdb-profile] limit = 200_000 conn_str = ["my-database.db"] [tool.harlequin.profiles.local-postgres] theme = "gruvbox" limit = 10_000 ... ``` -------------------------------- ### Install xclip on Debian/Ubuntu Source: https://harlequin.sh/docs/troubleshooting/copying-and-pasting Installs the xclip utility on Debian-based systems (like Ubuntu) to enable clipboard access for applications like Harlequin. ```bash sudo apt install xclip ``` -------------------------------- ### Install xsel on Debian/Ubuntu Source: https://harlequin.sh/docs/troubleshooting/copying-and-pasting Installs the xsel utility on Debian-based systems (like Ubuntu) to enable clipboard access for applications like Harlequin. ```bash sudo apt install xsel ``` -------------------------------- ### Connect to Databricks using OAuth Machine-to-Machine (M2M) Source: https://harlequin.sh/docs/databricks/index Connects to Databricks using the Harlequin CLI with OAuth Machine-to-Machine (M2M) authentication. Requires installing 'databricks-sdk', server hostname, HTTP path, client ID, and client secret. ```bash $ harlequin -a databricks --server-hostname ***.cloud.databricks.com --http-path /sql/1.0/endpoints/*** --client-id *** --client-secret *** ``` -------------------------------- ### Example Harlequin Initialization Script (SQL and Dot Commands) Source: https://harlequin.sh/docs/sqlite/initialization Demonstrates a typical Harlequin initialization script containing both SQL statements and SQLite CLI dot commands. SQL statements must be semicolon-terminated, while dot commands require newline termination. ```sql .open './my-database.sqlite' create table foo as select 1; ``` -------------------------------- ### Connect to Databricks using Personal Access Token (PAT) Source: https://harlequin.sh/docs/databricks/index Connects to Databricks using the Harlequin CLI with Personal Access Token (PAT) authentication. Requires server hostname, HTTP path, and the access token. ```bash $ harlequin -a databricks --server-hostname ***.cloud.databricks.com --http-path /sql/1.0/endpoints/*** --access-token dabpi*** ``` -------------------------------- ### Load SQLite Extensions using Harlequin CLI Source: https://harlequin.sh/docs/sqlite/extensions Demonstrates how to load SQLite extensions when starting Harlequin using the command-line interface. This method accepts one or more paths to SQLite extension executables. ```bash $ harlequin -e ./fts5 -e ./json1 ``` -------------------------------- ### Install Harlequin with S3 Support Source: https://harlequin.sh/docs/files/remote Installs the Harlequin package with the necessary 's3' extra, enabling support for remote S3 objects. This is a prerequisite for using Harlequin with S3-compatible storage. ```bash $ uv tool install 'harlequin[s3]' ``` -------------------------------- ### Connect to Databricks using Username and Password Source: https://harlequin.sh/docs/databricks/index Connects to Databricks using the Harlequin CLI with basic username and password authentication. Requires server hostname, HTTP path, username, and password. ```bash $ harlequin -a databricks --server-hostname ***.cloud.databricks.com --http-path /sql/1.0/endpoints/*** --username *** --password *** ``` -------------------------------- ### Pass DB Kwargs String to ADBC Driver Source: https://harlequin.sh/docs/adbc Example of passing database-specific configuration options as a semicolon-separated string to the `--db-kwargs-str` argument. ```bash $ `--db-kwargs-str "username=flight_username;password=flight_password;adbc.flight.sql.client_option.tls_skip_verify=true"` ``` -------------------------------- ### Launch Harlequin Keys App Source: https://harlequin.sh/docs/keymaps/config This command starts the Harlequin Keys App, a tool for creating and managing custom keymaps. The app allows users to view, edit, and save key bindings, facilitating the customization of Harlequin's keyboard shortcuts. ```bash $ harlequin --keys ``` -------------------------------- ### Install Harlequin with Pinned DuckDB Version Source: https://harlequin.sh/docs/troubleshooting/duckdb-version-mismatch Installs Harlequin while explicitly setting the DuckDB version to ensure compatibility. This is useful for avoiding version mismatch errors. ```bash $ uv tool install harlequin --with 'duckdb==1.1.3' ``` -------------------------------- ### Disable Harlequin Initialization Script Source: https://harlequin.sh/docs/duckdb/initialization Shows how to start Harlequin without executing the default or specified initialization script using the --no-init option. ```bash $ harlequin --no-init ``` -------------------------------- ### Start Harlequin with Wherobots (Custom Runtime and Region) Source: https://harlequin.sh/docs/wherobots Launches Harlequin with WherobotsDB, specifying a custom runtime size (e.g., MEDIUM) and AWS region (e.g., AWS_US_WEST_2). ```shell $ harlequin -a wherobots --api-key --runtime MEDIUM --region AWS_US_WEST_2 ``` -------------------------------- ### Launch Harlequin with Truecolor Enabled Source: https://harlequin.sh/docs/troubleshooting/appearance Temporarily enables truecolor rendering for Harlequin by setting the COLORTERM environment variable for a single command execution. This is useful for testing if truecolor support is the issue. ```shell COLORTERM=truecolor harlequin ``` -------------------------------- ### Create Harlequin Databricks Alias Source: https://harlequin.sh/docs/databricks/index Creates a command alias 'hdb' in the .bash_profile for the Harlequin Databricks connection string. This simplifies launching Harlequin with Databricks. Requires server hostname, HTTP path, and access token. ```bash $ echo 'alias hdb="harlequin -a databricks --server-hostname ***.cloud.databricks.com --http-path /sql/1.0/endpoints/1234567890abcdef --access-token dabpi***"' >> .bash_profile ``` -------------------------------- ### Launch Harlequin Keys App with Specific Config Source: https://harlequin.sh/docs/keymaps/config This command launches the Harlequin Keys App, specifying a custom configuration file, profile, and keymap. This allows for targeted editing of key bindings within a particular setup, overriding default or globally discovered configurations. ```bash $ harlequin --config-path ~/my-config.toml --profile Foo --keys ``` -------------------------------- ### Disable Harlequin Databricks Initialization Source: https://harlequin.sh/docs/databricks/initialization Command-line example demonstrating how to disable the execution of the default Databricks initialization script in Harlequin using the --no-init option. ```bash harlequin -a databricks --no-init ``` -------------------------------- ### Open Harlequin with In-Memory DuckDB Session Source: https://harlequin.sh/docs/duckdb/index Starts Harlequin with an in-memory DuckDB session. This is the default behavior when no database files are specified. ```shell $ harlequin ``` -------------------------------- ### Connect to Databricks using OAuth User-to-Machine (U2M) Source: https://harlequin.sh/docs/databricks/index Connects to Databricks using the Harlequin CLI with OAuth User-to-Machine (U2M) authentication. Specify 'databricks-oauth' or 'azure-oauth' for the auth-type. Requires server hostname and HTTP path. ```bash $ harlequin -a databricks --server-hostname ***.cloud.databricks.com --http-path /sql/1.0/endpoints/*** --auth-type databricks-oauth ``` -------------------------------- ### Display Harlequin Help Source: https://harlequin.sh/docs/risingwave Displays the full list of available options and commands for Harlequin, useful for understanding all configuration possibilities. ```bash harlequin --help ``` -------------------------------- ### Check DuckDB CLI Version Source: https://harlequin.sh/docs/troubleshooting/duckdb-version-mismatch Command to determine the installed version of the DuckDB command-line interface (CLI). This helps in identifying potential version conflicts. ```bash duckdb --version ``` -------------------------------- ### Skip Legacy Indexing in Harlequin Source: https://harlequin.sh/docs/databricks/index Uses the '--skip-legacy-indexing' flag with the Harlequin CLI to improve Data Catalog indexing speed for Unity Catalog users. This flag omits indexing of legacy metastores. ```bash $ harlequin --skip-legacy-indexing ``` -------------------------------- ### Connect to RisingWave using individual connection parameters Source: https://harlequin.sh/docs/risingwave Launches Harlequin with the RisingWave adapter, providing connection details through individual command-line options such as host, port, user, password, and database name. ```bash harlequin -a risingwave -h localhost -p 5432 -U my-user --password my-pass -d my-database ``` -------------------------------- ### Authenticate BigQuery with gcloud CLI Source: https://harlequin.sh/docs/bigquery/auth These commands authenticate the Google Cloud SDK's Application Default Credentials (ADC) with BigQuery. This allows applications, including Harlequin, to access BigQuery resources without explicit API keys. Ensure the `gcloud` CLI is installed. ```bash gcloud auth application-default login ``` ```bash gcloud auth login --update-adc ``` -------------------------------- ### Override Harlequin Locale via Command Line Source: https://harlequin.sh/docs/troubleshooting/locale This command demonstrates how to explicitly set the locale for Harlequin using the `--locale` option. This is useful when the system's default locale is not desired or when testing specific locale configurations. Harlequin will exit with an error if the specified locale is not installed on the system. ```bash $ harlequin --locale en_US.UTF-8 ``` -------------------------------- ### Select Database Adapter via Command Line Source: https://harlequin.sh/docs/adapters Demonstrates how to switch to a different database adapter using the `--adapter` or `-a` command-line option. This is useful for connecting to databases other than the default (DuckDB). ```bash harlequin -a sqlite ``` -------------------------------- ### Markdown Frontmatter for Additional Adapter Documentation Pages Source: https://harlequin.sh/docs/contributing/adapter-guide This snippet illustrates the frontmatter for supplementary documentation pages for an adapter. It specifies the page title and a sequential menu order, incrementing from the main index page. ```markdown --- title: "Auth and Permissions" menuOrder: 101 --- ``` -------------------------------- ### Connect to a database using Harlequin and an ODBC connection string Source: https://harlequin.sh/docs/odbc/index Demonstrates how to launch Harlequin using the ODBC adapter and connect to a database by providing a DSN-less connection string. The adapter only accepts the connection string as an argument. ```bash harlequin -a odbc 'Driver={ODBC Driver 18 for SQL Server};Server=tcp:harlequin-example.database.windows.net,1433;Database=dev;Uid=harlequin;Pwd=my_secret;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;' ``` -------------------------------- ### Run Harlequin Command Line Source: https://harlequin.sh/docs/getting-started/running The basic command structure for running Harlequin from the command line. It accepts options and connection strings to control its behavior and database connections. ```shell $ harlequin [OPTIONS] [CONN_STR] ``` -------------------------------- ### Run Harlequin with Django Source: https://harlequin.sh/docs/getting-started/running Command to launch Harlequin using Django's database configuration via the django-harlequin package. ```shell $ ./manage.py harlequin ``` -------------------------------- ### Select Harlequin Profile Source: https://harlequin.sh/docs/config-file/profiles Loads Harlequin with configuration from a specific profile using the `--profile` option. ```bash harlequin --profile my-profile ``` -------------------------------- ### Launch Harlequin Config Wizard Source: https://harlequin.sh/docs/config-file/creating-config Launches the Harlequin interactive configuration wizard to generate or edit configuration files. This is the primary way to create new configuration files. ```bash $ harlequin --config ``` -------------------------------- ### Connect to RisingWave using PostgreSQL DSN Source: https://harlequin.sh/docs/risingwave Launches Harlequin with the RisingWave adapter, specifying the connection details using a PostgreSQL Data Source Name (DSN). ```bash harlequin -a risingwave "postgres://my-user:my-pass@localhost:5432/my-database" ``` -------------------------------- ### Display Harlequin Help Information Source: https://harlequin.sh/docs/cassandra Displays the full list of command-line options available for the Harlequin application. This is useful for discovering all configurable settings and arguments. ```shell $ harlequin --help ``` -------------------------------- ### Registering Harlequin Adapter Plugin with Poetry Source: https://harlequin.sh/docs/contributing/adapter-guide Defines how to register a custom adapter as a plugin for Harlequin using Poetry. This involves specifying the entry point in the `pyproject.toml` file under the `harlequin.adapter` group, linking a plugin name to the adapter class within your package. ```toml [tool.poetry.plugins."harlequin.adapter"] my-adapter = "my_package_name:MyAdapter" ``` -------------------------------- ### Connect to NebulaGraph using Harlequin Source: https://harlequin.sh/docs/nebulagraph Connects to a NebulaGraph database using the Harlequin CLI. Requires specifying the adapter, host, port, username, and password. ```bash $ harlequin -a nebulagraph -h 127.0.0.1 -p 9669 -u root --password password ``` -------------------------------- ### Connect to Trino using Harlequin CLI (Minimum) Source: https://harlequin.sh/docs/trino Connects to a Trino instance using the Harlequin command-line interface with minimal required parameters: host, port, and user. ```shell $ harlequin -a trino -h localhost -p 8080 -U my_user ``` -------------------------------- ### Run Harlequin with ADBC, FlightSQL, and DB Kwargs Source: https://harlequin.sh/docs/adbc Connects to a FlightSQL database using Harlequin's ADBC adapter, providing connection details and database-specific keyword arguments. ```bash $ harlequin -a adbc "grpc+tls://localhost:31337" --driver-type flightsql --db-kwargs-str "username=flight_username;password=flight_password;adbc.flight.sql.client_option.tls_skip_verify=true" ``` -------------------------------- ### Configure Harlequin Initialization Script Path Source: https://harlequin.sh/docs/duckdb/initialization Demonstrates how to specify a custom path for the DuckDB initialization script using the --init-path option in Harlequin. ```bash $ harlequin --init-path path/to/my/script.sql ``` -------------------------------- ### Run Individual Tests and Linters Source: https://harlequin.sh/docs/contributing/index Provides commands to run specific testing and linting tools individually: pytest for tests, black for code formatting, ruff for linting and fixing, and mypy for type checking. ```bash pytest black . ruff . --fix mypy ``` -------------------------------- ### Image Conversion using ImageMagick Source: https://harlequin.sh/docs/contributing/adapter-guide This command uses ImageMagick to prepare a database icon for the Harlequin website. It resizes the icon to 50x50 pixels, converts it to grayscale, and saves it in the designated assets directory. ```bash $ convert my_db_icon.png -resize 50x50 -colorspace gray ./src/lib/assets/databases/my_db_icon.png ``` -------------------------------- ### Connect to MySQL/MariaDB Database via CLI Source: https://harlequin.sh/docs/mysql/index Connects to a MySQL or MariaDB database using Harlequin. Requires specifying the adapter with `-a mysql` and providing connection details like host, port, user, password, and database name as command-line options. ```bash $ harlequin -a mysql -h localhost -p 3306 -U root --password example --database dev ``` -------------------------------- ### Configuring Harlequin Initialization Script Path Source: https://harlequin.sh/docs/sqlite/initialization Shows how to specify a custom path for the Harlequin initialization script using the --init-path option (or its aliases -i, -init). This overrides the default ~/.sqliterc. ```bash harlequin -a sqlite --init-path path/to/my/script.sql ``` -------------------------------- ### Load Unsigned Extension from Custom Repo via CLI Source: https://harlequin.sh/docs/duckdb/extensions This command illustrates loading an unsigned extension ('prql') from a custom repository URL using the `-u` and `--custom-extension-repo` flags in Harlequin. ```bash harlequin -u -e prql --custom-extension-repo http://welsch.lu/duckdb/prql/latest ``` -------------------------------- ### Run Harlequin with ADBC and PostgreSQL Driver Source: https://harlequin.sh/docs/adbc Connects to a PostgreSQL database using Harlequin's ADBC adapter with a standard Postgres DSN. ```bash $ harlequin -a adbc --driver-type postgresql "postgres://my-user:my-pass@localhost:5432/my-database" ``` -------------------------------- ### Markdown Frontmatter for Adapter Documentation Source: https://harlequin.sh/docs/contributing/adapter-guide This snippet shows the required frontmatter for an adapter's main documentation page (index.md). It defines the page title and sets the menu sort order, with values typically between 100 and 200. ```markdown --- title: "Adapter: BigQuery" menuOrder: 100 --- ``` -------------------------------- ### Run Harlequin with ADBC and Driver Type Source: https://harlequin.sh/docs/adbc Executes Harlequin using the ADBC adapter, specifying the driver type and connection string. ```bash $ harlequin -a adbc "$SNOWFLAKE_URI" --driver-type snowflake ``` -------------------------------- ### Connect to Postgres using individual options Source: https://harlequin.sh/docs/postgres Connects to a PostgreSQL database using individual command-line options for host, port, user, password, and database name. This is an alternative to using a DSN and provides more granular control. ```bash $ harlequin -a postgres -h localhost -p 5432 -U my-user --password my-pass -d my-database ``` -------------------------------- ### Disabling Harlequin Initialization Source: https://harlequin.sh/docs/sqlite/initialization Illustrates how to launch Harlequin without executing any initialization script. This can be achieved by providing a non-existent path to --init-path or by using the --no-init option. ```bash harlequin -a sqlite --no-init ``` -------------------------------- ### Inserting and Copying File Paths in Harlequin Source: https://harlequin.sh/docs/files/index Learn how to insert file paths directly into the query editor or copy them to the clipboard using keyboard shortcuts within the Harlequin Data Catalog. ```text Ctrl+Enter or Ctrl+j (insert file path) Ctrl+c (copy file path to clipboard) ``` -------------------------------- ### Create table from DuckDB functions Source: https://harlequin.sh/docs/getting-started/usage Creates a new table named 'foo' by selecting all functions from the DuckDB database. This populates the Data Catalog. ```sql create table foo as select * from duckdb_functions() ``` -------------------------------- ### Run All Tests and Linters with Make Source: https://harlequin.sh/docs/contributing/index Executes all defined tests and code quality checks (linters) for the Harlequin project using a Makefile. This is a convenient way to ensure the codebase adheres to quality standards. ```bash make ``` -------------------------------- ### Select all functions from DuckDB Source: https://harlequin.sh/docs/getting-started/usage Executes a SQL query to retrieve all functions available in the DuckDB database. The results are displayed in the Results Viewer. ```sql select * from duckdb_functions() ``` -------------------------------- ### Load Unsigned DuckDB Extension via CLI Source: https://harlequin.sh/docs/duckdb/extensions This command shows how to load an unsigned DuckDB extension in Harlequin using the `-u` or `--unsigned` flag. This is similar to how it's done with the DuckDB CLI. ```bash harlequin -u ``` -------------------------------- ### Specify Custom Config Path using CLI Source: https://harlequin.sh/docs/config-file/discovery Demonstrates how to provide a custom path to a configuration file using the `--config-path` command-line option when invoking Harlequin. ```bash harlequin --config-path /path/to/my/file.toml ``` -------------------------------- ### Connect to Trino with Password Authentication Source: https://harlequin.sh/docs/trino Connects to a Trino instance using Harlequin CLI, providing a password for authentication. Requires setting '--require_auth' to 'password' and using the '--password' flag. ```shell $ harlequin -a trino -h localhost -p 8080 -U my_user --password my-pass --require_auth password ``` -------------------------------- ### Connect to Postgres using DSN Source: https://harlequin.sh/docs/postgres Connects to a PostgreSQL database by providing a Data Source Name (DSN) as a command-line argument to Harlequin. The DSN includes user, password, host, port, and database name. ```bash $ harlequin -a postgres "postgres://my-user:my-pass@localhost:5432/my-database" ``` -------------------------------- ### Connect Harlequin to MotherDuck Source: https://harlequin.sh/docs/duckdb/motherduck Connect to MotherDuck using the Harlequin CLI. This is the most basic connection method. ```shell harlequin "md:" ``` -------------------------------- ### Describe table 'foo' Source: https://harlequin.sh/docs/getting-started/usage Generates a SQL query to describe the schema of the table named 'foo'. This query is typically executed after selecting the 'Describe' interaction from the Data Catalog. ```sql describe foo ``` -------------------------------- ### SQLite Transaction Commands Source: https://harlequin.sh/docs/sqlite/transactions Demonstrates the basic SQL commands for managing transactions in SQLite. These include explicitly beginning a transaction, committing changes, and rolling back uncommitted changes. ```sql BEGIN; -- Your SQL statements here COMMIT; ``` ```sql BEGIN; -- Your SQL statements here ROLLBACK; ``` -------------------------------- ### Replace Default Keymap with CLI Source: https://harlequin.sh/docs/keymaps/usage Specifies a single, complete keymap to be used by Harlequin. This replaces any default keymap. Usage via the `--keymap-name` CLI option. ```bash harlequin --keymap-name "my-complete-keymap" ``` -------------------------------- ### Accessing File Tree Tab in Harlequin Data Catalog Source: https://harlequin.sh/docs/files/index Instructions on how to switch to the 'Files' tab within the Harlequin Data Catalog to view file trees. This can be done by mouse selection or keyboard navigation. ```text F6 (focus on Data Catalog) k or j (switch tabs) ``` -------------------------------- ### Bypass Default Harlequin Profile Source: https://harlequin.sh/docs/config-file/profiles Runs Harlequin without loading the default profile configuration by specifying the `None` profile. ```bash harlequin --profile None ``` -------------------------------- ### Attach Local DuckDB Database to MotherDuck Source: https://harlequin.sh/docs/duckdb/motherduck Connect to MotherDuck and attach a local DuckDB database file as an additional data source. The 'md:' connection must be listed first. ```shell harlequin "md:" "local_duck.db" ``` -------------------------------- ### Connect Harlequin to Existing Wherobots Session (WebSocket URL) Source: https://harlequin.sh/docs/wherobots Connects Harlequin to an already running Wherobots SQL session by providing its WebSocket URL. This bypasses the need for API keys or tokens if the session is already active. ```shell $ harlequin -a wherobots --api-key --ws-url ``` -------------------------------- ### Open Harlequin with DuckDB Database Files Source: https://harlequin.sh/docs/duckdb/index Connects Harlequin to one or more DuckDB database files. If a file does not exist, it will be created. Supports relative and absolute paths. ```shell $ harlequin "path/to/duck.db" "another_duck.db" ``` -------------------------------- ### Run Harlequin in MotherDuck SaaS Mode Source: https://harlequin.sh/docs/duckdb/motherduck Connect to MotherDuck in SaaS Mode by passing the 'md_saas' option to the Harlequin CLI. ```shell harlequin "md:" --md_saas ``` -------------------------------- ### Extend Keymap with CLI Source: https://harlequin.sh/docs/keymaps/usage Loads multiple keymaps, merging their bindings. This allows extending the default keymap with custom bindings. Achieved by repeating the `--keymap-name` CLI option. ```bash harlequin --keymap-name "vscode" --keymap-name "more_arrows" ``` -------------------------------- ### Configure Keymaps via Config File Source: https://harlequin.sh/docs/keymaps/usage Defines Harlequin keymap configurations using profiles in a TOML config file. Allows specifying one or multiple keymaps per profile, equivalent to CLI options. ```toml default_profile = "my-first-profile" [profiles.my-first-profile] keymap_name = ["my-complete-keymap"] [profiles.my-second-profile] keymap_name = ["vscode", "more_arrows"] ``` -------------------------------- ### Display S3 Bucket with Prefix Source: https://harlequin.sh/docs/files/remote Command to display objects within a specific S3 bucket, filtered by a key prefix. The prefix is appended to the bucket name. ```bash $ harlequin --show-s3 my-bucket/my-prefix ``` -------------------------------- ### Display a Single S3 Bucket Source: https://harlequin.sh/docs/files/remote Command to display objects within a specific S3 bucket. The bucket name is provided as an argument to the `--show-s3` option. ```bash $ harlequin --show-s3 my-bucket ``` -------------------------------- ### Update Snapshot Tests Source: https://harlequin.sh/docs/contributing/index Updates the 'ground truth' snapshot files after tests have failed due to changes. This command regenerates the expected outputs for snapshot tests, assuming the changes are intended. ```bash pytest --snapshot-update ``` -------------------------------- ### Connect to GCS Bucket with Prefix using AWS Profile Source: https://harlequin.sh/docs/files/remote A one-liner command to connect to a Google Cloud Storage bucket with a specified prefix, using a configured AWS profile for authentication. It sets the AWS_PROFILE environment variable and specifies the GCS endpoint. ```bash $ AWS_PROFILE=gcs harlequin --s3 "https://storage.googleapis.com/my-gcs-bucket/my-prefix" ``` -------------------------------- ### Display Buckets from a Specific Endpoint Source: https://harlequin.sh/docs/files/remote Command to display buckets from an S3-compatible endpoint, such as Google Cloud Storage. Requires specifying the endpoint URL without a path. ```bash $ harlequin --show-s3 "https://storage.googleapis.com" ``` -------------------------------- ### Connect Harlequin to Wherobots with Custom Hostname Source: https://harlequin.sh/docs/wherobots Connects Harlequin to a Wherobots stack using a specified base hostname. Useful for connecting to non-default or private Wherobots instances. ```shell $ harlequin -a wherobots --api-key [host] ``` -------------------------------- ### Open Query File in Harlequin Source: https://harlequin.sh/docs/troubleshooting/copying-and-pasting Opens a query file within the Harlequin application using a keyboard shortcut. ```keyboard shortcut ctrl+o ``` -------------------------------- ### Display All S3 Buckets Source: https://harlequin.sh/docs/files/remote Command to display all Amazon S3 buckets accessible by the authenticated user. Use with caution if you have a very large number of buckets. ```bash $ harlequin --show-s3 all ``` -------------------------------- ### Define Custom Keymap in Harlequin (TOML) Source: https://harlequin.sh/docs/keymaps/config This TOML snippet demonstrates how to define a custom keymap named 'more_arrows' in Harlequin. Each section maps specific keys to actions within the results viewer, with an optional 'key_display' for footer visibility. This allows users to extend or override default key bindings. ```toml [[keymaps.more_arrows]] keys="w" action="results_viewer.cursor_up" key_display="⬆/w" [[keymaps.more_arrows]] keys="a" action="results_viewer.cursor_left" key_display="⬅/a" [[keymaps.more_arrows]] keys="s,j" action="results_viewer.cursor_down" key_display="⬇/s/j" [[keymaps.more_arrows]] keys="d" action="results_viewer.cursor_right" key_display="➡/d" ``` -------------------------------- ### Authenticate Harlequin with MotherDuck Token (CLI) Source: https://harlequin.sh/docs/duckdb/motherduck Connect to MotherDuck using a service token provided directly via a CLI option. ```shell harlequin "md:" --md_token ``` -------------------------------- ### Enable Harlequin Key Bindings in VS Code Terminal Source: https://harlequin.sh/docs/troubleshooting/key-bindings This configuration snippet for VS Code's `settings.json` file disables chord key bindings and ensures key bindings are sent to the shell, allowing Harlequin's shortcuts to function correctly. ```json { "terminal.integrated.allowChords": false, "terminal.integrated.sendKeybindingsToShell": true } ``` -------------------------------- ### Open In-Memory SQLite Session with Harlequin Source: https://harlequin.sh/docs/sqlite/index Opens an in-memory SQLite session using the Harlequin CLI. No specific database file is required for this operation. ```bash $ harlequin -a sqlite ``` -------------------------------- ### Open SQLite Database Files with Harlequin Source: https://harlequin.sh/docs/sqlite/index Connects Harlequin to one or more specified SQLite database files. Paths to the database files are provided as arguments. ```bash $ harlequin -a sqlite "path/to/sqlite.db" "another_sqlite.db" ``` -------------------------------- ### Check Harlequin's DuckDB Version Source: https://harlequin.sh/docs/troubleshooting/duckdb-version-mismatch SQL query to execute within Harlequin's query editor to determine the version of DuckDB that Harlequin is currently using. ```sql select version() ``` -------------------------------- ### Export Data to File (CSV, Parquet, JSON, ORC, Feather) Source: https://harlequin.sh/docs/export Exports query results to a file in various formats including CSV, Parquet, JSON, ORC, and Feather. Users can specify the file path and format, with format-specific options available. ```keyboard Execute query. Press ctrl+e to open Data Exporter. Enter file path and select format. Press Enter or click 'Export'. ``` -------------------------------- ### Open Harlequin with DuckDB in Read-Only Mode Source: https://harlequin.sh/docs/duckdb/index Opens a DuckDB database file in read-only mode using the `--read-only` or `-r` flag. This prevents any modifications to the database file. ```shell $ harlequin -r "path/to/duck.db" ``` -------------------------------- ### Set SQLite Connection Mode with Harlequin Source: https://harlequin.sh/docs/sqlite/index Specifies the connection mode for a SQLite database using the `--mode` option with the Harlequin CLI. 'rw' indicates read-write mode. ```bash $ harlequin -a sqlite --mode rw ``` -------------------------------- ### Set SQLite Read Timeout with Harlequin Source: https://harlequin.sh/docs/sqlite/index Configures the maximum time Harlequin will wait to read from a locked SQLite table, specified in seconds using the `--timeout` option. ```bash $ harlequin -a sqlite --timeout 60 ``` -------------------------------- ### Open SQLite Database in Read-Only Mode with Harlequin Source: https://harlequin.sh/docs/sqlite/index Opens a SQLite database file in read-only mode using the `-r` flag with the Harlequin CLI. ```bash $ harlequin -a sqlite -r "path/to/sqlite.db" ``` -------------------------------- ### Configure SQLite Statement Caching with Harlequin Source: https://harlequin.sh/docs/sqlite/index Sets the number of SQL statements that SQLite should cache to improve performance by reducing parsing overhead. This is done using the `--cached-statements` option. ```bash $ harlequin -a sqlite --cached-statements 256 ``` -------------------------------- ### Copy Data to Clipboard (Tab-Separated) Source: https://harlequin.sh/docs/export Copies selected data from the Results Viewer to the system clipboard. The data is formatted as tab-separated values (TSV), compatible with many applications like Excel and Google Sheets. ```keyboard Select data using ctrl+a, shift+arrow keys, or click-and-drag. Press ctrl+c to copy to clipboard. ``` -------------------------------- ### Disable Timezone Data Download in Harlequin Source: https://harlequin.sh/docs/troubleshooting/timezone-windows This command prevents Harlequin from automatically downloading the timezone database on Windows. It's useful if you want to manage the database manually or avoid potential network issues. Using this option may lead to crashes when handling timestamptz data. ```bash harlequin --no-download-tzdata ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.