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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- feat(schemas): add key field to table definitions
- feat(tables): support loading from query results

## [0.6.0] - 2026-07-07
Expand Down
1 change: 1 addition & 0 deletions docs/AddManagedTableDecl.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ One table declaration inside an add-schema request body.

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**key** | **List[str]** | Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected. | [optional]
**name** | **str** | |

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AddManagedTableRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Request body for adding a table to an existing schema: `POST /v1/connections/{id

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**key** | **List[str]** | Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected. | [optional]
**name** | **str** | |

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/DatabaseDefaultTableDecl.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ One table declaration inside a default-catalog schema, supplied at database-crea

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**key** | **List[str]** | Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected. | [optional]
**name** | **str** | |

## Example
Expand Down
8 changes: 5 additions & 3 deletions hotdata/models/add_managed_table_decl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class AddManagedTableDecl(BaseModel):
"""
One table declaration inside an add-schema request body.
""" # noqa: E501
key: Optional[List[StrictStr]] = Field(default=None, description="Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected.")
name: StrictStr
__properties: ClassVar[List[str]] = ["name"]
__properties: ClassVar[List[str]] = ["key", "name"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -81,6 +82,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"key": obj.get("key"),
"name": obj.get("name")
})
return _obj
Expand Down
8 changes: 5 additions & 3 deletions hotdata/models/add_managed_table_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class AddManagedTableRequest(BaseModel):
"""
Request body for adding a table to an existing schema: `POST /v1/connections/{id}/schemas/{schema}/tables` and `POST /v1/databases/{id}/schemas/{schema}/tables`.
""" # noqa: E501
key: Optional[List[StrictStr]] = Field(default=None, description="Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected.")
name: StrictStr
__properties: ClassVar[List[str]] = ["name"]
__properties: ClassVar[List[str]] = ["key", "name"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -81,6 +82,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"key": obj.get("key"),
"name": obj.get("name")
})
return _obj
Expand Down
8 changes: 5 additions & 3 deletions hotdata/models/database_default_table_decl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, StrictStr
from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class DatabaseDefaultTableDecl(BaseModel):
"""
One table declaration inside a default-catalog schema, supplied at database-create time.
""" # noqa: E501
key: Optional[List[StrictStr]] = Field(default=None, description="Columns that uniquely identify a row, enabling the key-based load modes (`delete`, `update`, `upsert`) on this table: those loads match rows by these columns' values. Omit (the default) to declare no key; the table can still be loaded with `replace` and `append`, but key-based modes are then rejected.")
name: StrictStr
__properties: ClassVar[List[str]] = ["name"]
__properties: ClassVar[List[str]] = ["key", "name"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -81,6 +82,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
return cls.model_validate(obj)

_obj = cls.model_validate({
"key": obj.get("key"),
"name": obj.get("name")
})
return _obj
Expand Down
3 changes: 3 additions & 0 deletions test/test_add_managed_schema_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def make_instance(self, include_optional) -> AddManagedSchemaRequest:
name = '',
tables = [
hotdata.models.add_managed_table_decl.AddManagedTableDecl(
key = [
''
],
name = '', )
]
)
Expand Down
3 changes: 3 additions & 0 deletions test/test_add_managed_table_decl.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def make_instance(self, include_optional) -> AddManagedTableDecl:
model = AddManagedTableDecl()
if include_optional:
return AddManagedTableDecl(
key = [
''
],
name = ''
)
else:
Expand Down
3 changes: 3 additions & 0 deletions test/test_add_managed_table_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def make_instance(self, include_optional) -> AddManagedTableRequest:
model = AddManagedTableRequest()
if include_optional:
return AddManagedTableRequest(
key = [
''
],
name = ''
)
else:
Expand Down
3 changes: 3 additions & 0 deletions test/test_create_database_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def make_instance(self, include_optional) -> CreateDatabaseRequest:
name = '',
tables = [
hotdata.models.database_default_table_decl.DatabaseDefaultTableDecl(
key = [
''
],
name = '', )
], )
]
Expand Down
3 changes: 3 additions & 0 deletions test/test_database_default_schema_decl.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def make_instance(self, include_optional) -> DatabaseDefaultSchemaDecl:
name = '',
tables = [
hotdata.models.database_default_table_decl.DatabaseDefaultTableDecl(
key = [
''
],
name = '', )
]
)
Expand Down
3 changes: 3 additions & 0 deletions test/test_database_default_table_decl.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ def make_instance(self, include_optional) -> DatabaseDefaultTableDecl:
model = DatabaseDefaultTableDecl()
if include_optional:
return DatabaseDefaultTableDecl(
key = [
''
],
name = ''
)
else:
Expand Down