Python sqlalchemy.func 模块,bernoulli() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用sqlalchemy.func.bernoulli()

项目:ShelbySearch    作者:Agentscreech    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:QualquerMerdaAPI    作者:tiagovizoto    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:gardenbot    作者:GoestaO    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:flask-zhenai-mongo-echarts    作者:Fretice    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:watcher    作者:nosmokingbandit    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:flask    作者:bobohope    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)
项目:Chorus    作者:DonaldBough    | 项目源码 | 文件源码
def tablesample(selectable, sampling, name=None, seed=None):
    """Return a :class:`.TableSample` object.

    :class:`.TableSample` is an :class:`.Alias` subclass that represents
    a table with the TABLESAMPLE clause applied to it.
    :func:`~.expression.tablesample`
    is also available from the :class:`.FromClause` class via the
    :meth:`.FromClause.tablesample` method.

    The TABLESAMPLE clause allows selecting a randomly selected approximate
    percentage of rows from a table. It supports multiple sampling methods,
    most commonly BERNOULLI and SYSTEM.

    e.g.::

        from sqlalchemy import func

        selectable = people.tablesample(
                    func.bernoulli(1),
                    name='alias',
                    seed=func.random())
        stmt = select([selectable.c.people_id])

    Assuming ``people`` with a column ``people_id``, the above
    statement would render as::

        SELECT alias.people_id FROM
        people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
        REPEATABLE (random())

    .. versionadded:: 1.1

    :param sampling: a ``float`` percentage between 0 and 100 or
        :class:`.functions.Function`.

    :param name: optional alias name

    :param seed: any real-valued SQL expression.  When specified, the
     REPEATABLE sub-clause is also rendered.

    """
    return _interpret_as_from(selectable).tablesample(
        sampling, name=name, seed=seed)