Skip to content

Interface mismatch with the Admin API #27

@abarmat

Description

@abarmat

The python library functions are not matching the latest version of the Amp admin interface https://github.com/edgeandnode/amp/blob/main/docs/openapi-specs/admin.spec.json

This leads to issues such as amp.admin.errors.AdminAPIError: [EMPTY_TABLES_AND_FUNCTIONS] At least one table or function must be provided when trying to register or deploy a new manifest.

The library is using this as a reference:

"OutputSchemaRequest": {
        "type": "object",
        "description": "Request payload for output schema analysis\n\nContains the SQL query to analyze and optional configuration flags.",
        "required": [
          "sql_query"
        ],
        "properties": {
          "is_sql_dataset": {
            "type": "boolean",
            "description": "Whether this is a SQL dataset (affects block number field inclusion)\n\nWhen true, a special block number field is prepended to the schema.\nThis field tracks the block number for each row in SQL datasets."
          },
          "sql_query": {
            "type": "string",
            "description": "The SQL query to analyze for output schema determination"
          }
        }
      },

While the proper one would be something like:

class SchemaRequest(BaseModel):
    """
    Request for schema analysis with dependencies, tables, and functions
    """

    dependencies: Optional[dict[str, str]] = None
    """
    External dataset dependencies mapped by alias

    Maps alias names to dataset references (namespace/name@version or namespace/name@hash).
    """
    functions: Optional[dict[str, Any]] = None
    """
    User-defined function definitions mapped by function name

    Maps function names to their complete definitions including input/output types
    and implementation source code.
    """
    tables: Optional[dict[str, str]] = None
    """
    Table definitions mapped by table name

    Each table is defined by a SQL query that may reference
    tables from dependencies using the alias names.
    """

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions