Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
0320356
fix(types): refuse a non-boolean unsigned when the type is rendered
vistart Oct 11, 2026
641b3dc
refactor(postgres): one class per storage, not two
vistart Oct 11, 2026
fcc9939
refactor(postgres): read declared fields directly instead of probing …
vistart Oct 11, 2026
0d5e319
refactor(postgres): follow the statement and expression renames
vistart Oct 14, 2026
84a2069
refactor(postgres): migrate constraints onto the two-level branch nodes
vistart Oct 14, 2026
9a52680
fix(postgres): converge the constraint switches onto the (self) probe…
vistart Oct 14, 2026
b170e57
refactor(postgres): split the wildcard by grammar position
vistart Oct 14, 2026
bb7e28c
ci: point testsuite at the matching branch
vistart Oct 14, 2026
b52c8a9
fix(postgres): name the protocol's column-constraint parameter as the…
vistart Oct 14, 2026
f5848ca
fix(postgres): read the auto-increment flag where the two-level split…
vistart Oct 14, 2026
2744319
docs(postgres): carry the renames into the README and docs
vistart Oct 14, 2026
8f56c2c
refactor(expression): follow the core renames and the word-form contr…
vistart Oct 16, 2026
a457f1a
refactor(postgres): read declared fields instead of probing with getattr
vistart Oct 17, 2026
6a76a52
refactor(postgres): follow the core's kind-based artifact registry
vistart Oct 17, 2026
32dc4c7
feat(postgres): adopt the typed value nodes with PostgreSQL literal s…
vistart Oct 18, 2026
bfab917
fix(postgres): follow the classed function entry points
vistart Oct 18, 2026
79a0d81
refactor(postgres): follow the literal architecture the core settled
vistart Oct 19, 2026
280265d
refactor(postgres): audit the kinds this backend overrides and owns
vistart Oct 19, 2026
bd7c6b4
test(postgres): reconcile the roundtrip matrix with the plain-JSON ar…
vistart Oct 19, 2026
4b053c9
refactor(postgres): follow the rules the org settled for kinds
vistart Oct 19, 2026
c38eb99
test(postgres): move live-connection checks out of expression tests
vistart Oct 19, 2026
0db4972
fix(postgres): write the locking clause from its phrase, not its word
vistart Oct 19, 2026
4e6df12
fix(postgres): read the word an artifact carries, not the member it u…
vistart Oct 19, 2026
fa07e03
test(postgres): record the matrix reconciliation baseline
vistart Oct 19, 2026
0634333
docs(postgres): build a cast over the literal in the extension examples
vistart Oct 19, 2026
1a2289e
test(postgres): use the edge-table definition node the class is actua…
vistart Oct 19, 2026
d1af86a
test(postgres): walk core`s package instead of reading the shared reg…
vistart Oct 19, 2026
a1bb1a4
fix(postgres): declare the domain formatters this backend serves
vistart Oct 19, 2026
d95aad3
fix(postgres): follow core's EdgeTable rename in the PGQ scenarios
vistart Oct 19, 2026
8076ba7
fix(postgres): follow core's EdgeTable rename in the harness and matrix
vistart Oct 19, 2026
6002de4
fix(postgres): build the matview list with the with_ prefix core renamed
vistart Oct 19, 2026
07bbc24
fix(postgres): compose collate over a Literal with the factory, not a…
vistart Oct 19, 2026
641ec36
fix(postgres): cast a Literal with the cast factory, not a chain
vistart Oct 19, 2026
8327f08
fix(postgres): cast a Literal with the cast factory, not a chain
vistart Oct 19, 2026
1386d50
fix(postgres): build the extension-test values through the cast facto…
vistart Oct 20, 2026
16373ba
fix(postgres): give the aliased literals a typed path and the remaini…
vistart Oct 20, 2026
f4c1509
fix(postgres): collect every expression parameter at construction, an…
vistart Oct 20, 2026
2a82e72
refactor(postgres): build the introspection catalog queries from thei…
vistart Oct 20, 2026
d9b4d6e
refactor(postgres): build the database-size query through its express…
vistart Oct 20, 2026
4ffe8b3
refactor(postgres): let the status, enum and constraint text belong t…
vistart Oct 20, 2026
745ebe7
docs(postgres): spell the partition example through its node, and cor…
vistart Oct 20, 2026
7bdd317
fix(postgres): pass the LIKE operator as its enum, not the SQL keyword
vistart Oct 20, 2026
2d523e8
refactor(postgres): build introspection queries from nodes, not text
vistart Oct 20, 2026
3632369
fix(postgres): spell the replication lag with the version's own xlog …
vistart Oct 20, 2026
18cacb2
test(postgres): drop the codec pins the core fix retired
vistart Oct 20, 2026
dc8536f
chore: ignore .worktree/, the branch toolchain directories
vistart Oct 21, 2026
1168d85
fix(postgres): refuse a materialized view whose definition binds
vistart Oct 22, 2026
41fc05f
fix(postgres): the dialect surface, and the type positions it decides
vistart Oct 22, 2026
3c0dcab
refactor(expression)!: follow core's statement rename
vistart Oct 22, 2026
cbf680f
refactor(expression)!: name statement nodes, kinds and formatters alike
vistart Oct 23, 2026
0add231
refactor(function)!: answer function availability through the public …
vistart Oct 23, 2026
852802f
refactor(backend)!: call the core helpers by their public names
vistart Oct 23, 2026
1ca07e6
fix(introspection): take the cache from the manager, not the mixin
vistart Oct 23, 2026
9724e97
feat(introspection): answer for sequences, extensions and the two new…
vistart Oct 23, 2026
7c92c9d
test(introspection): let the CLI object fixture recover from a run th…
vistart Oct 24, 2026
65cc65f
test(introspection): name the CLI fixtures per run, not once for the …
vistart Oct 24, 2026
10e684a
test(introspection): let the sequence assertions ride the server's ca…
vistart Oct 24, 2026
bb90b42
fix(introspection): qualify the matview join by namespace, not by nam…
vistart Oct 24, 2026
f2006ea
test(introspection): give each CLI-object run a schema of its own
vistart Oct 24, 2026
453f7e1
docs(cli): say what introspect can ask about
vistart Oct 24, 2026
aeec36f
feat(introspection): declare what each backend family can answer
vistart Oct 24, 2026
49cd332
fix(cli): let this backend name its own types and drop the schema flag
vistart Oct 24, 2026
0df6c24
refactor(postgres)!: drop the underscores from the introspection cont…
vistart Oct 25, 2026
556c6e5
fix(postgres): declare the three families the protocols left out
vistart Oct 25, 2026
7be369c
test(postgres): test on 19rc1 and re-read a listing that lost a relation
vistart Oct 25, 2026
f4ca15c
refactor(postgres): name the materialized-view, sequence and extensio…
vistart Oct 25, 2026
0652c41
feat(cli)!: the introspect table aggregate is gone
vistart Oct 26, 2026
5ff9a17
fix(introspection): report what the catalog answers, not a second rea…
vistart Oct 27, 2026
634dd4d
test(postgres): stand-ins answer version_at_least, and an unadapted p…
vistart Oct 27, 2026
c894e40
fix(introspection): answer table_count from the same database-info row
vistart Oct 27, 2026
6eb017f
test(transaction): the local copy becomes a shim over the shared cont…
vistart Oct 27, 2026
a056d3b
feat(cli): a catalogue family takes an optional name
vistart Oct 30, 2026
6fec34b
feat(cli): the introspect types come with their capability switches
vistart Oct 30, 2026
51124f5
docs(cli): the introspect types, their names, and the removed aggregate
vistart Oct 30, 2026
609ace7
test(cli): the extensions-answer fakes adapt like every other CLI fake
vistart Oct 30, 2026
f1492ef
ci: install core from the release branch now that #127 has merged
vistart Oct 30, 2026
ce9fac5
docs(changelog): the fragments for #63
vistart Oct 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@fix/column-constraint-gates"

- name: Create postgres scenario config
run: |
Expand Down Expand Up @@ -284,7 +284,7 @@ jobs:
- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@fix/column-constraint-gates"

- name: Create postgres scenario config
run: |
Expand Down Expand Up @@ -396,7 +396,7 @@ jobs:
- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@fix/column-constraint-gates"

- name: Create postgres scenario config
run: |
Expand Down Expand Up @@ -459,12 +459,12 @@ jobs:
fail_ci_if_error: false

test-postgres-19:
name: Python 3.14 / postgres 19beta4
name: Python 3.14 / postgres 19rc1
runs-on: ubuntu-latest

services:
postgres:
image: postgres:19beta4
image: postgres:19rc1
env:
POSTGRES_DB: test_db
POSTGRES_USER: root
Expand Down Expand Up @@ -494,7 +494,7 @@ jobs:
- name: Install activerecord and testsuite
run: |
pip install "rhosocial-activerecord @ git+https://github.com/rhosocial/python-activerecord.git@release/v1.0.0.dev30"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@release/v1.0.0.dev17"
pip install "rhosocial-activerecord-testsuite @ git+https://github.com/rhosocial/python-activerecord-testsuite.git@fix/column-constraint-gates"

- name: Create postgres scenario config
run: |
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,8 @@ htmlcov/
# Claude Code temporary files (local only)
.claude/tmp/
.claude/plan*/
# Worktrees for feature/* and fix/* branches. Never tracked: a `git add -A`
# from the repo root would commit each branch's whole toolchain -- the venv, the
# build directory and the test artifacts -- and the directory disappears when the
# branch merges, so the history would keep a second copy of the source tree.
.worktree/
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _979088a_
- **Python**: `>=3.8`
- **Core**: `rhosocial-activerecord>=1.0.0.dev0,<2.0.0`
- **Driver**: `psycopg[binary]>=3.2.13`
- **CI-tested server versions**: 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19beta4
- **CI-tested server versions**: 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19rc1
- **Published**: PyPI `1.0.0.dev16`

## Installation
Expand All @@ -42,11 +42,11 @@ from uuid import UUID, uuid4
from rhosocial.activerecord.base import FieldProxy
from rhosocial.activerecord.backend.impl.postgres.backend import PostgresBackend
from rhosocial.activerecord.backend.impl.postgres.config import PostgresConnectionConfig
from rhosocial.activerecord.backend.expression import CreateTableExpression
from rhosocial.activerecord.backend.expression import CreateTableStatement
from rhosocial.activerecord.backend.expression.statements import (
ColumnConstraint,
ColumnConstraintType,
ColumnDefinition,
ColumnPrimaryKeyConstraint,
)
from rhosocial.activerecord.backend.expression.types import (
ArrayType,
Expand Down Expand Up @@ -81,13 +81,15 @@ Article.configure(
)

dialect = Article.__backend__.dialect
Article.__backend__.execute(*CreateTableExpression(
Article.__backend__.execute(*CreateTableStatement(
dialect,
"articles",
columns=[
ColumnDefinition(
dialect, "id", UUIDType(dialect),
constraints=[ColumnConstraint(dialect, ColumnConstraintType.PRIMARY_KEY)],
constraints=[ColumnConstraint(
dialect, branch=ColumnPrimaryKeyConstraint(dialect),
)],
),
ColumnDefinition(dialect, "title", VarCharType(dialect, 200)),
ColumnDefinition(dialect, "tags", ArrayType(dialect, TextType(dialect))),
Expand Down Expand Up @@ -179,7 +181,7 @@ operations.
- **`RETURNING` is version-gated.** The basic clause works broadly, but
`returning_old_new` and `update_returning_old` need PostgreSQL 18.
- Field annotations do not drive DDL. `list[str]`, `dict` and `UUID` columns
are described explicitly in the `CreateTableExpression` above.
are described explicitly in the `CreateTableStatement` above.

## Testing

Expand Down
1 change: 1 addition & 0 deletions changelog.d/63.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`extensions NAME` and `views NAME` on the introspect CLI, whose type list now derives from `_TYPE_CAPABILITIES`. Typed value nodes with PostgreSQL literal spellings, and the domain formatters this backend serves are declared.
1 change: 1 addition & 0 deletions changelog.d/63.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The catalogue and status questions are built from expression nodes, materialized views, sequences and extensions are statement factories, and the CLI adapts once at the entry rather than inside selected branches. A `NAME` a type cannot use is an error rather than an ignored argument.
1 change: 1 addition & 0 deletions changelog.d/63.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`table_count` comes from the same database-info row rather than a second reading, and the catalogue reports what it answered: materialized, foreign and partitioned table kinds, column dimensions, and extension facts.
1 change: 1 addition & 0 deletions changelog.d/63.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The expression round-trip harness is vendored beside the matrix, live-connection checks moved out of the expression tests, and CI installs core from `release/v1.0.0.dev30` now that core #127 has merged.
34 changes: 17 additions & 17 deletions docs/en_US/ddl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ The PostgreSQL backend supports the same type-safe DDL expressions as the core l

| Operation | PostgreSQL Support | Notes |
|----------|-------------------|-------|
| `CreateTableExpression` | ✅ Full | PRIMARY KEY, NOT NULL, UNIQUE, etc. |
| `DropTableExpression` | ✅ Full | IF EXISTS, CASCADE, RESTRICT |
| `AlterTableExpression` | ✅ Full | ADD/DROP COLUMN, ALTER COLUMN |
| `CreateIndexExpression` | ✅ Full | Index types (BTREE, HASH, GIN, GiST, BRIN) |
| `DropIndexExpression` | ✅ Full | |
| `CreateViewExpression` | ✅ Full | |
| `DropViewExpression` | ✅ Full | |
| `CreateTableStatement` | ✅ Full | PRIMARY KEY, NOT NULL, UNIQUE, etc. |
| `DropTableStatement` | ✅ Full | IF EXISTS, CASCADE, RESTRICT |
| `AlterTableStatement` | ✅ Full | ADD/DROP COLUMN, ALTER COLUMN |
| `CreateIndexStatement` | ✅ Full | Index types (BTREE, HASH, GIN, GiST, BRIN) |
| `DropIndexStatement` | ✅ Full | |
| `CreateViewStatement` | ✅ Full | |
| `DropViewStatement` | ✅ Full | |
| `PostgresCreateMaterializedViewExpression` | ✅ Full | IF NOT EXISTS, TABLESPACE, storage parameters (see [materialized views](./materialized_view.md)) |
| `PostgresRefreshMaterializedViewExpression` | ✅ Full | CONCURRENTLY (PG 9.4+, requires a UNIQUE index) |
| `PostgresAlterMaterializedViewExpression` | ✅ Full | RENAME TO, SET SCHEMA, SET/RESET storage parameters, OWNER TO |
| `PostgresRefreshMaterializedViewPgStatement` | ✅ Full | CONCURRENTLY (PG 9.4+, requires a UNIQUE index) |
| `PostgresAlterMaterializedViewStatement` | ✅ Full | RENAME TO, SET SCHEMA, SET/RESET storage parameters, OWNER TO |
| `PostgresDropMaterializedViewExpression` | ✅ Full | IF EXISTS, CASCADE |
| `CreatePartitionExpression` | ✅ Full | RANGE, LIST, HASH partitioning (PG 10+) |
| `AttachPartitionExpression` | ✅ Full | Standard ATTACH PARTITION; `CONCURRENTLY` is unsupported |
Expand All @@ -30,7 +30,7 @@ The PostgreSQL backend supports the same type-safe DDL expressions as the core l
PostgreSQL 10+ supports declarative partitioning. See [Partition Documentation](../postgres_specific_features/partition.md).

```python
partition = PostgresCreatePartitionExpression(
partition = PostgresCreatePartitionStatement(
dialect, parent_table="orders", partition_name="orders_2024_q1",
partition_type="RANGE", bounds="FROM ('2024-01-01') TO ('2024-04-01')",
)
Expand All @@ -44,18 +44,18 @@ See [Partition Documentation](../postgres_specific_features/partition.md) for pg

```python
from rhosocial.activerecord.backend.impl.postgres.expression.ddl.index import (
PostgresAlterIndexExpression, PostgresAlterIndexActionType,
PostgresReindexExpression,
PostgresAlterIndexStatement, PostgresAlterIndexActionType,
PostgresReindexStatement,
)

# ALTER INDEX ... RENAME TO
alter = PostgresAlterIndexExpression(
alter = PostgresAlterIndexStatement(
dialect, index_name="idx_old",
action=PostgresAlterIndexActionType.RENAME_TO("idx_new"),
)

# REINDEX CONCURRENTLY
reindex = PostgresReindexExpression(
reindex = PostgresReindexStatement(
dialect, target_type="INDEX", target_name="idx_corrupted",
concurrently=True,
)
Expand All @@ -66,7 +66,7 @@ reindex = PostgresReindexExpression(
PostgreSQL supports various index types:

```python
create_idx = CreateIndexExpression(
create_idx = CreateIndexStatement(
dialect,
index_name="idx_users_name",
table_name="users",
Expand All @@ -82,7 +82,7 @@ PostgreSQL supports partial indexes with WHERE clause:
```python
from rhosocial.activerecord.backend.expression import Column, Literal

create_idx = CreateIndexExpression(
create_idx = CreateIndexStatement(
dialect,
index_name="idx_active_users",
table_name="users",
Expand All @@ -96,7 +96,7 @@ create_idx = CreateIndexExpression(
PostgreSQL supports schemas:

```python
create_table = CreateTableExpression(
create_table = CreateTableStatement(
dialect,
table_name="schema_name.users",
columns=columns
Expand Down
26 changes: 13 additions & 13 deletions docs/en_US/ddl/materialized_view.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
| Expression | Purpose | PostgreSQL-specific options |
|---|---|---|
| `PostgresCreateMaterializedViewExpression` | `CREATE MATERIALIZED VIEW` | `schema`, `if_not_exists`, `storage_options`, `tablespace`, `column_aliases`, `with_data` |
| `PostgresRefreshMaterializedViewExpression` | `REFRESH MATERIALIZED VIEW` | `schema`, `concurrently`, `with_data` |
| `PostgresAlterMaterializedViewExpression` | `ALTER MATERIALIZED VIEW` | `schema`, action list |
| `PostgresRefreshMaterializedViewPgStatement` | `REFRESH MATERIALIZED VIEW` | `schema`, `concurrently`, `with_data` |
| `PostgresAlterMaterializedViewStatement` | `ALTER MATERIALIZED VIEW` | `schema`, action list |
| `PostgresDropMaterializedViewExpression` | `DROP MATERIALIZED VIEW` | `schema`, `if_exists`, `cascade` |

The generic core expressions (`CreateMaterializedViewExpression`,
`RefreshMaterializedViewExpression`, `DropMaterializedViewExpression`) remain
The generic core expressions (`CreateMaterializedViewStatement`,
`RefreshMaterializedViewStatement`, `DropMaterializedViewStatement`) remain
usable; they simply do not carry `schema` / `if_not_exists`.

## Creating a materialized view

```python
from rhosocial.activerecord.backend.expression import Column, FunctionCall, QueryExpression, TableExpression
from rhosocial.activerecord.backend.expression import Column, FunctionCall, QueryStatement, TableExpression
from rhosocial.activerecord.backend.impl.postgres.storage_parameters import PostgresStorageParameter
from rhosocial.activerecord.backend.impl.postgres.expression.ddl import (
PostgresCreateMaterializedViewExpression,
)

summary = QueryExpression(
summary = QueryStatement(
dialect=dialect,
select=[
Column(dialect, "product_id"),
Expand Down Expand Up @@ -117,19 +117,19 @@ create = PostgresCreateMaterializedViewExpression(

```python
from rhosocial.activerecord.backend.impl.postgres.expression.ddl import (
PostgresRefreshMaterializedViewExpression,
PostgresRefreshMaterializedViewPgStatement,
)

# standard refresh
PostgresRefreshMaterializedViewExpression(dialect=dialect, name="sales_summary")
PostgresRefreshMaterializedViewPgStatement(dialect=dialect, name="sales_summary")

# concurrent refresh — requires a UNIQUE index, rejected below PG 9.4
PostgresRefreshMaterializedViewExpression(
PostgresRefreshMaterializedViewPgStatement(
dialect=dialect, name="sales_summary", schema="reporting", concurrently=True
)

# populate a WITH NO DATA view
PostgresRefreshMaterializedViewExpression(
PostgresRefreshMaterializedViewPgStatement(
dialect=dialect, name="sales_daily", with_data=True
)
```
Expand All @@ -145,15 +145,15 @@ creation).

```python
from rhosocial.activerecord.backend.impl.postgres.expression.ddl import (
PostgresAlterMaterializedViewExpression,
PostgresAlterMaterializedViewStatement,
PostgresChangeMaterializedViewOwnerAction,
PostgresRenameMaterializedViewAction,
PostgresResetMaterializedViewPropertiesAction,
PostgresSetMaterializedViewPropertiesAction,
PostgresSetMaterializedViewSchemaAction,
)

alter = PostgresAlterMaterializedViewExpression(
alter = PostgresAlterMaterializedViewStatement(
dialect=dialect,
view_name="sales_summary",
schema="reporting",
Expand Down Expand Up @@ -209,7 +209,7 @@ info = backend.introspector.get_materialized_view_info("sales_summary")
exists = backend.introspector.materialized_view_exists("sales_summary")
```

Each `ViewInfo` carries:
Each `IntrospectionViewInfo` carries:

| Field | Meaning |
|---|---|
Expand Down
16 changes: 8 additions & 8 deletions docs/en_US/postgres_specific_features/dialect.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,22 @@ sql, params = expr.to_sql()
PostgreSQL supports copying table structure using the `LIKE` clause with fine-grained control over what gets copied via INCLUDING/EXCLUDING options.

PostgreSQL renders the clause form `CREATE TABLE t (LIKE src [INCLUDING ...])`,
modelled by `CreateTableLikeExpression`.
modelled by `CreateTableLikeStatement`.

```python
from rhosocial.activerecord.backend.expression import CreateTableLikeExpression
from rhosocial.activerecord.backend.expression import CreateTableLikeStatement
from rhosocial.activerecord.backend.impl.postgres.dialect import PostgresDialect

# Basic usage - copy table structure
expr = CreateTableLikeExpression(
expr = CreateTableLikeStatement(
PostgresDialect(),
table="users_copy",
like_table="users",
)
# Generates: CREATE TABLE "users_copy" (LIKE "users")

# With INCLUDING options (dictionary format - recommended)
expr = CreateTableLikeExpression(
expr = CreateTableLikeStatement(
PostgresDialect(),
table="users_copy",
like_table="users",
Expand All @@ -168,15 +168,15 @@ expr = CreateTableLikeExpression(
# INCLUDING CONSTRAINTS INCLUDING INDEXES EXCLUDING COMMENTS)

# With schema-qualified source table
expr = CreateTableLikeExpression(
expr = CreateTableLikeStatement(
PostgresDialect(),
table="users_copy",
like_table=('public', 'users'),
)
# Generates: CREATE TABLE "users_copy" (LIKE "public"."users")

# With TEMPORARY and IF NOT EXISTS
expr = CreateTableLikeExpression(
expr = CreateTableLikeStatement(
PostgresDialect(),
table="temp_users",
like_table="users",
Expand All @@ -186,7 +186,7 @@ expr = CreateTableLikeExpression(
# Generates: CREATE TEMPORARY TABLE IF NOT EXISTS "temp_users" (LIKE "users")

# Including everything
expr = CreateTableLikeExpression(
expr = CreateTableLikeStatement(
PostgresDialect(),
table="users_copy",
like_table="users",
Expand All @@ -207,7 +207,7 @@ expr = CreateTableLikeExpression(
- `ALL` - Copy everything

**Important Notes:**
- `CreateTableLikeExpression` carries only the target table and source `like_table`
- `CreateTableLikeStatement` carries only the target table and source `like_table`
- `like_options` accepts a dict (`including`/`excluding`), a list of feature
strings (treated as `INCLUDING`), or a list of `(action, feature)` tuples
- Only `temporary` and `if_not_exists` flags are considered
Expand Down
Loading
Loading