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
67 changes: 67 additions & 0 deletions providers/google/docs/connections/leveldb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

.. http://www.apache.org/licenses/LICENSE-2.0

.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

.. _howto/connection:leveldb:

LevelDB Connection
==================

The **LevelDB** connection type enables tasks to interact with a local (or mounted) `LevelDB
<https://github.com/google/leveldb>`_ database by means of
:class:`airflow.providers.google.leveldb.hooks.leveldb.LevelDBHook`
(which is a thin wrapper around the `Plyvel <https://plyvel.readthedocs.io/>`_ client).

Default Connection IDs
----------------------

Hooks related to LevelDB use ``leveldb_default`` by default.

Configuring the Connection
--------------------------

LevelDB runs as an *embedded* key‑value store—there is no server to connect to.
Consequently, the Airflow connection only needs enough information to locate (and,
optionally, create) the on‑disk database.

Host
**Path** to the database directory (for example ``/tmp/testdb`` or
``/opt/airflow/data/leveldb``).
If the directory does not yet exist you may allow the hook to create it via the
``create_if_missing`` extra parameter (see below).

Login / Password / Port / Schema
Not used by :class:`LevelDBHook`. Leave these fields blank.

Extra (optional, JSON)
Additional options accepted by :py:meth:`plyvel.DB`:

``create_if_missing`` *(bool)*
When *true*, a new database directory will be created if it is absent.
Defaults to *false* (raises an error if the path does not exist).

``error_if_exists`` *(bool)*
Raise an exception if the database already exists (defaults to *false*).

Any other keyword argument supported by ``plyvel.DB`` will be forwarded
unchanged.

Example *Extra* field value::

{
"create_if_missing": true,
"error_if_exists": false
}
2 changes: 2 additions & 0 deletions providers/google/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,8 @@ connection-types:
connection-type: leveldb
- hook-class-name: airflow.providers.google.ads.hooks.ads.GoogleAdsHook
connection-type: google_ads
- hook-class-name: airflow.providers.google.cloud.hooks.looker.LookerHook
connection-type: gcp_looker

extra-links:
- airflow.providers.google.cloud.links.alloy_db.AlloyDBBackupsLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
class LookerHook(BaseHook):
"""Hook for Looker APIs."""

conn_name_attr = "looker_conn_id"
default_conn_name = "looker_default"
conn_type = "gcp_looker"
hook_name = "Google Looker"

def __init__(
self,
looker_conn_id: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,10 @@ def get_provider_info():
"hook-class-name": "airflow.providers.google.ads.hooks.ads.GoogleAdsHook",
"connection-type": "google_ads",
},
{
"hook-class-name": "airflow.providers.google.cloud.hooks.looker.LookerHook",
"connection-type": "gcp_looker",
},
],
"extra-links": [
"airflow.providers.google.cloud.links.alloy_db.AlloyDBBackupsLink",
Expand Down