Files
odoo-stubs/odoo-stubs/tools/sql.pyi
Trinh Anh Ngoc f7cd5b8c90 isort + black
2023-05-18 21:36:12 +07:00

75 lines
2.4 KiB
Python

from typing import Iterable, Literal
from ..models import BaseModel
from ..sql_db import Cursor
_CONFDELTYPES: dict[str, str]
def existing_tables(cr: Cursor, tablenames: Iterable[str]) -> list[str]: ...
def table_exists(cr: Cursor, tablename: str) -> bool: ...
def table_kind(cr: Cursor, tablename: str) -> str | None: ...
def create_model_table(
cr: Cursor, tablename: str, comment: str | None = ..., columns: Iterable = ...
) -> None: ...
def table_columns(cr: Cursor, tablename: str) -> dict: ...
def column_exists(cr: Cursor, tablename: str, columnname: str) -> int: ...
def create_column(
cr: Cursor,
tablename: str,
columnname: str,
columntype: str,
comment: str | None = ...,
) -> None: ...
def rename_column(
cr: Cursor, tablename: str, columnname1: str, columnname2: str
) -> None: ...
def convert_column(
cr: Cursor, tablename: str, columnname: str, columntype: str
) -> None: ...
def set_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ...
def drop_not_null(cr: Cursor, tablename: str, columnname: str) -> None: ...
def constraint_definition(
cr: Cursor, tablename: str, constraintname: str
) -> str | None: ...
def add_constraint(
cr: Cursor, tablename: str, constraintname: str, definition: str
) -> None: ...
def drop_constraint(cr: Cursor, tablename: str, constraintname: str) -> None: ...
def add_foreign_key(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> Literal[True]: ...
def get_foreign_keys(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> list[str]: ...
def fix_foreign_key(
cr: Cursor,
tablename1: str,
columnname1: str,
tablename2: str,
columnname2: str,
ondelete,
) -> list[str]: ...
def index_exists(cr: Cursor, indexname: str) -> int: ...
def create_index(
cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]
) -> None: ...
def create_unique_index(
cr: Cursor, indexname: str, tablename: str, expressions: Iterable[str]
) -> None: ...
def drop_index(cr: Cursor, indexname: str, tablename: str) -> None: ...
def drop_view_if_exists(cr: Cursor, viewname: str) -> None: ...
def escape_psql(to_escape: str) -> str: ...
def pg_varchar(size: int = ...) -> str: ...
def reverse_order(order: str) -> str: ...
def increment_field_skiplock(record: BaseModel, field: str) -> bool: ...