Python sqlalchemy 模块-NVARCHAR 实例源码

Python sqlalchemy 模块,NVARCHAR 实例源码

我们从Python开源项目中,提取了以下2代码示例,用于说明如何使用sqlalchemy.NVARCHAR

项目:flasky    作者:RoSEOu    | 项目源码 | 文件源码
def create_table(self, name, *columns, **kw):
        """Issue a "create table" instruction using the current migration context.

        This directive receives an argument list similar to that of the
        Traditional :class:`sqlalchemy.schema.Table` construct,but without the
        Metadata::

            from sqlalchemy import INTEGER,VARCHAR,NVARCHAR,Column
            from alembic import op

            op.create_table(
                'account',
                Column('id',INTEGER,primary_key=True),
                Column('name',VARCHAR(50),nullable=False),
                Column('description',NVARCHAR(200))
                Column('timestamp',TIMESTAMP,server_default=func.Now())
            )

        Note that :meth:`.create_table` accepts :class:`~sqlalchemy.schema.Column`
        constructs directly from the sqlAlchemy library.  In particular,
        default values to be created on the database side are
        specified using the ``server_default`` parameter,and not
        ``default`` which only specifies Python-side defaults::

            from alembic import op
            from sqlalchemy import Column,func

            # specify "DEFAULT Now" along with the "timestamp" column
            op.create_table('account',
                Column('timestamp',server_default=func.Now())
            )

        :param name: Name of the table
        :param \*columns: collection of :class:`~sqlalchemy.schema.Column`
         objects within
         the table,as well as optional :class:`~sqlalchemy.schema.Constraint`
         objects
         and :class:`~.sqlalchemy.schema.Index` objects.
        :param schema: Optional schema name to operate within.
        :param \**kw: Other keyword arguments are passed to the underlying
         :class:`sqlalchemy.schema.Table` object created for the command.

        """
        self.impl.create_table(
            self._table(name, **kw)
        )
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def create_table(self, **kw)
        )

相关文章

Python setuptools.dep_util 模块,newer_pairwise_group() ...
Python chainer.utils.type_check 模块,eval() 实例源码 我...
Python chainer.utils.type_check 模块,prod() 实例源码 我...
Python chainer.utils.type_check 模块,expect() 实例源码 ...
Python multiprocessing.managers 模块,BaseProxy() 实例源...
Python multiprocessing.managers 模块,RemoteError() 实例...