Skip to content

Bug: notion get and notion db get fail with "Schema has no property with attribute name properties" #1

Description

@chen-gdp

Bug Description

Commands notion get <database_id> and notion db get <database_id> fail with error:

"Schema has no property with attribute name properties"

Root Cause

The code uses obj.schema.properties.items() but according to ultimate_notion API:

  • Schema does NOT have a .properties attribute
  • Correct API is schema.to_dict() which returns dict[str, Property]

Files Affected

  1. src/notion_cli/commands/get.py line 53-55
  2. src/notion_cli/commands/database.py line 26

Expected Behavior

  • notion db get <id> should return database schema with properties
  • notion get <id> should work for both pages and databases

Reproduction

notion db get "400821ec-bbb5-4f69-b1d1-7af3e99a0264" --json
# Returns: {"success": false, "error": {"code": "DB_GET_ERROR", "message": "Schema has no property with attribute name properties"}}

Suggested Fix

Use schema.to_dict() instead of schema.properties.items():

# Wrong:
{name: prop.type for name, prop in db.schema.properties.items()}

# Correct:
{name: type(prop).__name__ for name, prop in db.schema.to_dict().items()}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions