$24 GRAYBYTE WORDPRESS FILE MANAGER $60

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python37/lib/python3.7/site-packages/alembic/ddl/

HOME
Current File : /opt/alt/python37/lib/python3.7/site-packages/alembic/ddl//oracle.py
from sqlalchemy.ext.compiler import compiles

from .impl import DefaultImpl
from .base import alter_table, AddColumn, ColumnName, \
    format_column_name, ColumnNullable, \
    format_server_default, ColumnDefault, format_type, ColumnType


class OracleImpl(DefaultImpl):
    __dialect__ = 'oracle'
    transactional_ddl = False
    batch_separator = "/"
    command_terminator = ""

    def __init__(self, *arg, **kw):
        super(OracleImpl, self).__init__(*arg, **kw)
        self.batch_separator = self.context_opts.get(
            "oracle_batch_separator",
            self.batch_separator)

    def _exec(self, construct, *args, **kw):
        result = super(OracleImpl, self)._exec(construct, *args, **kw)
        if self.as_sql and self.batch_separator:
            self.static_output(self.batch_separator)
        return result

    def emit_begin(self):
        self._exec("SET TRANSACTION READ WRITE")

    def emit_commit(self):
        self._exec("COMMIT")


@compiles(AddColumn, 'oracle')
def visit_add_column(element, compiler, **kw):
    return "%s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        add_column(compiler, element.column, **kw),
    )


@compiles(ColumnNullable, 'oracle')
def visit_column_nullable(element, compiler, **kw):
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "NULL" if element.nullable else "NOT NULL"
    )


@compiles(ColumnType, 'oracle')
def visit_column_type(element, compiler, **kw):
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "%s" % format_type(compiler, element.type_)
    )


@compiles(ColumnName, 'oracle')
def visit_column_name(element, compiler, **kw):
    return "%s RENAME COLUMN %s TO %s" % (
        alter_table(compiler, element.table_name, element.schema),
        format_column_name(compiler, element.column_name),
        format_column_name(compiler, element.newname)
    )


@compiles(ColumnDefault, 'oracle')
def visit_column_default(element, compiler, **kw):
    return "%s %s %s" % (
        alter_table(compiler, element.table_name, element.schema),
        alter_column(compiler, element.column_name),
        "DEFAULT %s" %
        format_server_default(compiler, element.default)
        if element.default is not None
        else "DEFAULT NULL"
    )


def alter_column(compiler, name):
    return 'MODIFY %s' % format_column_name(compiler, name)


def add_column(compiler, column, **kw):
    return "ADD %s" % compiler.get_column_specification(column, **kw)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 6.48 AM
root / 996
0755
__pycache__
--
31 Aug 2024 6.48 AM
root / 996
0755
__init__.py
0.122 KB
17 Oct 2015 2.18 AM
root / 996
0644
base.py
5.785 KB
17 Oct 2015 2.18 AM
root / 996
0644
impl.py
11.802 KB
17 Oct 2015 2.18 AM
root / 996
0644
mssql.py
7.986 KB
17 Oct 2015 2.18 AM
root / 996
0644
mysql.py
11.41 KB
17 Oct 2015 2.18 AM
root / 996
0644
oracle.py
2.624 KB
17 Oct 2015 2.18 AM
root / 996
0644
postgresql.py
5.199 KB
17 Oct 2015 2.18 AM
root / 996
0644
sqlite.py
3.438 KB
17 Oct 2015 2.18 AM
root / 996
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF