mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2025-02-22 11:12:46 +03:00
Documentation
This commit is contained in:
parent
314090fa56
commit
395902b9c7
|
@ -1,6 +1,11 @@
|
||||||
Change Log
|
Change Log
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
Unreleased
|
||||||
|
----------
|
||||||
|
- Bug fix: add field names list explicitly to Database.insert method (anci)
|
||||||
|
- Added RunPython and RunSQL migrations (M1hacka)
|
||||||
|
|
||||||
v0.9.7
|
v0.9.7
|
||||||
------
|
------
|
||||||
- Add `distinct` method to querysets
|
- Add `distinct` method to querysets
|
||||||
|
|
|
@ -32,16 +32,19 @@ Each migration file is expected to contain a list of `operations`, for example:
|
||||||
|
|
||||||
The following operations are supported:
|
The following operations are supported:
|
||||||
|
|
||||||
|
|
||||||
**CreateTable**
|
**CreateTable**
|
||||||
|
|
||||||
A migration operation that creates a table for a given model class. If the table already exists, the operation does nothing.
|
A migration operation that creates a table for a given model class. If the table already exists, the operation does nothing.
|
||||||
|
|
||||||
In case the model class is a `BufferModel`, the operation first creates the underlying on-disk table, and then creates the buffer table.
|
In case the model class is a `BufferModel`, the operation first creates the underlying on-disk table, and then creates the buffer table.
|
||||||
|
|
||||||
|
|
||||||
**DropTable**
|
**DropTable**
|
||||||
|
|
||||||
A migration operation that drops the table of a given model class. If the table does not exist, the operation does nothing.
|
A migration operation that drops the table of a given model class. If the table does not exist, the operation does nothing.
|
||||||
|
|
||||||
|
|
||||||
**AlterTable**
|
**AlterTable**
|
||||||
|
|
||||||
A migration operation that compares the table of a given model class to the model’s fields, and alters the table to match the model. The operation can:
|
A migration operation that compares the table of a given model class to the model’s fields, and alters the table to match the model. The operation can:
|
||||||
|
@ -52,6 +55,7 @@ A migration operation that compares the table of a given model class to the mode
|
||||||
|
|
||||||
Default values are not altered by this operation.
|
Default values are not altered by this operation.
|
||||||
|
|
||||||
|
|
||||||
**AlterTableWithBuffer**
|
**AlterTableWithBuffer**
|
||||||
|
|
||||||
A compound migration operation for altering a buffer table and its underlying on-disk table. The buffer table is dropped, the on-disk table is altered, and then the buffer table is re-created. This is the procedure recommended in the ClickHouse documentation for handling scenarios in which the underlying table needs to be modified.
|
A compound migration operation for altering a buffer table and its underlying on-disk table. The buffer table is dropped, the on-disk table is altered, and then the buffer table is re-created. This is the procedure recommended in the ClickHouse documentation for handling scenarios in which the underlying table needs to be modified.
|
||||||
|
@ -61,7 +65,7 @@ Applying this migration operation to a regular table has the same effect as an `
|
||||||
|
|
||||||
**RunPython**
|
**RunPython**
|
||||||
|
|
||||||
A migration operation that runs python function inside migration.
|
A migration operation that runs a Python function. The function receives the `Database` instance to operate on.
|
||||||
|
|
||||||
def forward(database):
|
def forward(database):
|
||||||
database.insert([
|
database.insert([
|
||||||
|
@ -69,14 +73,14 @@ A migration operation that runs python function inside migration.
|
||||||
])
|
])
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
RunPython(forward),
|
migrations.RunPython(forward),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
**RunSQL**
|
**RunSQL**
|
||||||
|
|
||||||
A migration operation that runs raw SQL queries inside migration.
|
A migration operation that runs raw SQL queries. It expects a string containing an SQL query, or an array of SQL-query strings.
|
||||||
SQL parameter can be a string or array of SQL-query strings
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user