Looker SDK Codegen

repository·main·Indexed 42 days ago

https://github.com/looker-open-source/sdk-codegen

A toolset for generating client-side language bindings (SDKs) for the Looker API. It automates fetching OpenAPI specifications from a Looker instance and converting them into usable code for various programming languages, including a community-supported C# .NET SDK (Look#) and Kotlin-based SDKs for Java.

Tokens
85.5K
Snippets
185
Records
407
Agent score
55%

What's inside Looker SDK Codegen

  1. Overview of Looker SDK code generator core files

    main

    The sdk-codegen package contains the OpenAPI analysis files and the source code required to generate method and type declarations for various programming languages.

    Important Usage Note: This package is DEPRECATED AND NOT SUPPORTED for direct use. Users should instead interact with this package indirectly through the main SDK Codegen project repository.

    Because it has no Node.js dependencies, this package is capable of running in a browser environment.

  2. What is RunIt

    main

    RunIt is a React-based, specification-driven REST API request tester. It is the core engine used by Looker's API Explorer to test API endpoints.

    RunIt is designed to be flexible via a configuration provider interface, allowing it to operate in two distinct modes:

    1. Looker Extension Framework runtime: Integrated directly within the Looker environment.
    2. Stand-alone browser application: Operates independently, using OAuth and CORS for authentication and request submission.
  3. Overview of Looker GSheets as data tables API

    main

    The wholly-sheet package provides routines to treat a Google Sheet (GSheet) as a relational database. In this model:

    • A GSheet document acts as the database.
    • A Sheet tab (or sheet tab) acts as a single data table.
    • A Row in the tab acts as a data row.

    The package uses WhollySheet for data table operations and SheetSDK to communicate with the Google Sheets API RESTful endpoints, bypassing the standard Google API for JavaScript to ensure compatibility with the Looker extension framework.

  4. Overview of Looker SDK code generator scripts

    main

    This package provides Node-based scripts used by the Looker SDK Codegen project to automate the generation of SDK language bindings.

    Important Constraints:

    • Environment: These scripts have Node.js dependencies and cannot be used in a browser environment.
    • Support Status: This package is DEPRECATED AND NOT SUPPORTED for direct use. It is intended to be used indirectly via the SDK Codegen project.
  5. Overview of the Look# C# .NET SDK

    main

    Look# is the C# .NET SDK for Looker, developed using the 'Build Your Own SDK' principles. It provides a strongly typed C# runtime library for interacting with the Looker API.

    Key features include:

    • Strong Typing: HTTP responses are mapped to strongly typed C# models.
    • Cross-Platform: Built on .NET Core 6.x, making it compatible with macOS, Windows, and Linux.
    • API Coverage: Includes API 4.0 methods (SDK calls) and models (SDK types) generated directly from the Looker API specification.
    • Testing: Includes unit and functional tests (e.g., AllDashboardsTests demonstrating LINQ usage).

    Support Status: Look# is currently community supported via issues or questions in the repository. It has not yet reached official support status from Looker.

  6. Overview of the Looker Extension SDK

    main

    The Looker Extension SDK is a client-side library used by Looker extensions to interact with their host context (the Looker UI).

    Key Concepts

    • Client-Host Model: The extension acts as a client running inside a sandboxed <iframe>, while Looker acts as the host.
    • Communication: The SDK translates function calls into messages passed safely across the iframe boundary. This is the only supported interface for interacting with the host.
    • Security & Authentication: The SDK allows the host to handle complex tasks like API authentication. This means your extension does not need to manage credentials or perform manual authentication setup.

    Available Resources

    • React Bindings: For React-based extensions, use @looker/extension-sdk-react.
    • Templates: Use the create looker extension utility to generate template files and get started quickly.
    • Examples: Reference the extension-examples repository for implementation patterns.
  7. Overview of the Looker Artifact API SDK

    main

    The Looker Artifact API SDK is a package designed to create dynamic tables by leveraging the Looker Artifact API's key/value store. It replaces the Google Sheets-based 'data table' implementation used in wholly-sheet with a more robust persistence layer managed via the Artifact API.

    Warning: This package is currently classified as alpha or experimental. It is subject to drastic changes or removal at any time. Additionally, the Looker Artifact API is currently reserved for Looker's own extensions and is not officially available for other uses. The underlying artifact endpoints in the Looker API are also marked as alpha.

  8. Automate Looker content cleanup with Cloud Functions and Cloud Scheduler

    main

    This automation uses a Google Cloud Function and the Looker Python SDK to prevent content bloat by automatically archiving and deleting unused Looker content.

    Cleanup Logic

    1. Soft Delete (Archiving): Dashboards and Looks unused for a configurable number of days (default: 90) are moved to the Looker Trash folder. This is reversible.
    2. Hard Delete (Permanent): Content in the Trash folder for a configurable number of days (default: 90) is permanently deleted.
      • Dashboard Backup: Before permanent deletion, dashboard LookML is backed up to a Google Cloud Storage (GCS) bucket.
      • Warning: Permanently deleted content is lost forever. Only dashboards can be restored via the import_dashboard_from_lookml method using the GCS backup.

    Important Limitations

    • This automation only works for Looks and user-defined dashboards.
    • It does not handle LookML-defined dashboards; those must be managed by removing their LookML files from the LookML project.
  9. Overview of the Looker SDK components

    main

    The Looker SDK ecosystem consists of three primary layers designed to help developers interact with Looker as a platform:

    1. Looker API: The core service described by an OpenAPI specification. The current stable version is 4.0. (Note: API 3.x has been removed).
    2. Looker API Explorer: An interactive reference tool for testing API calls. It is available as a standalone web tool at developers.looker.com/api/explorer/ or as an installable extension within a Looker instance via the Looker Marketplace.
    3. Language SDKs: Client-side libraries (e.g., Python, TypeScript) that provide high-level classes and methods to make calling the Looker API more ergonomic. Some are officially supported by Looker/Google, while others are community-supported.