crate / crate/sqlalchemy-cratedb

UX: Improve situation with weird `__table_args__` syntax

Open
#142 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
9
Forks
4
Avg merge
6d 12h
Merged PRs (30d)
3

Description

## Problem
Coming from those recent improvements ...
- https://github.com/crate/sqlalchemy-cratedb/pull/139
- https://github.com/crate/sqlalchemy-cratedb/pull/141

... @seut mentioned that the need to convey special CrateDB table options like that ...

```python
__table_args__ = {
'crate_"translog.durability"': "'async'",
}
```
... is very unfortunate from an UX perspective. I agree with that assessment.

## Proposal
It would be so nice to be able to write it down like:
```python
__table_args__ = {
"crate.translog.durability": "async",
}
```
or even like that if the `crate` prefix is not necessary:
```python
__table_args__ = {
"translog.durability": "async",
}
```

Additionally we should improve the [documentation about `__table_args__`](https://cratedb.com/docs/sqlalchemy-cratedb/overview.html#additional-table-args), removing any concrete parameter documentation and only link to the related [cratedb reference documentation](https://cratedb.com/docs/crate/reference/en/latest/sql/statements/create-table.html).
If we need a `crate` prefix, we need to document that each parameter must be prefixed, nothing more, no concrete parameter documentation, otherwise we duplicate documentation and it gets out dated once CrateDB support more.

## Thoughts
SQLAlchemy will be the first instance to receive those options, while evaluating the ORM model. We will need to check where it breaks down the line, and whether we can do something to improve on behalf of the dialect implementation, or if there would be a need to improve SQLAlchemy itself to support such edge cases.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.