Skip to main content

description

Project description

garf for Knowledge Graph Search API

PyPI Downloads PyPI

garf-knowledge-graph-api simplifies fetching data from Knowledge Graph Search API using SQL-like queries.

Prerequisites

Installation

pip install garf-knowledge-graph-api

Usage

Run as a library

from garf.community.google.knowledge_graph import report_fetcher
from garf.io import writer


# Specify query
query = """
  SELECT
    result_score,
    @id AS id,
    @type AS type,
    description,
    image.url AS url
  FROM query
  WHERE {query}
""

# Fetch report
fetched_report = (
  report_fetcher.KnowledgeGraphApiReportFetcher()
  .fetch(query, query="<YOUR_SEARCH_QUERY_HERE">)
)

# Write report to console
console_writer = writer.create_writer('console')
console_writer.write(fetched_report, 'output')

Run via CLI

Install garf-executors package to run queries via CLI (pip install garf-executors).

garf <PATH_TO_QUERIES> --source knowledge-graph-api \
  --output <OUTPUT_TYPE> \
  --source.<SOURCE_PARAMETER=VALUE>

where:

  • <PATH_TO_QUERIES> - local or remove files containing queries
  • <OUTPUT_TYPE> - output supported by garf-io library.
  • <SOURCE_PARAMETER=VALUE - key-value pairs to refine fetching, check available source parameters.

Available source parameters

name values comments
ids One or many Knowledge Graph Ids Multiple ids are supported, should be comma-separated
query Search query i.e. "Radiohead"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

garf_knowledge_graph_api-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

garf_knowledge_graph_api-1.0.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file garf_knowledge_graph_api-1.0.0.tar.gz.

File metadata

  • Download URL: garf_knowledge_graph_api-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for garf_knowledge_graph_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 220e3dcb92c6660dbc814d8bccdd4a502c5a4861cc6c9cf8cd8392e90c4df2bc
MD5 5dd6b4d20f1ac282b209f8f8b657a63e
BLAKE2b-256 35e1de279d3ee174727e0dd9d1c4f51a438a3cd5a4666acd96cc79b0ee5bd5a9

See more details on using hashes here.

File details

Details for the file garf_knowledge_graph_api-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: garf_knowledge_graph_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for garf_knowledge_graph_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7419f5a5f1c6dde5969ef03c594cbd4b20f818663d6113f8658989cd4ab64b5d
MD5 897e52942b893727289b0002ab22ef10
BLAKE2b-256 c97d8a55a794c05dd79ca13e8b00238e5f5baeb37c8ac2931f47f21f83fd58cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page