✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server366.web-hosting.com ​🇻​♯➤ 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 67.223.118.204 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.36
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/testing/suite//test_sequence.py
from .. import config
from .. import fixtures
from ..assertions import eq_
from ..config import requirements
from ..schema import Column
from ..schema import Table
from ... import Integer
from ... import MetaData
from ... import schema
from ... import Sequence
from ... import String
from ... import testing


class SequenceTest(fixtures.TablesTest):
    __requires__ = ("sequences",)
    __backend__ = True

    run_create_tables = "each"

    @classmethod
    def define_tables(cls, metadata):
        Table(
            "seq_pk",
            metadata,
            Column("id", Integer, Sequence("tab_id_seq"), primary_key=True),
            Column("data", String(50)),
        )

        Table(
            "seq_opt_pk",
            metadata,
            Column(
                "id",
                Integer,
                Sequence("tab_id_seq", optional=True),
                primary_key=True,
            ),
            Column("data", String(50)),
        )

        Table(
            "seq_no_returning",
            metadata,
            Column(
                "id",
                Integer,
                Sequence("noret_id_seq"),
                primary_key=True,
            ),
            Column("data", String(50)),
            implicit_returning=False,
        )

        if testing.requires.schemas.enabled:
            Table(
                "seq_no_returning_sch",
                metadata,
                Column(
                    "id",
                    Integer,
                    Sequence("noret_sch_id_seq", schema=config.test_schema),
                    primary_key=True,
                ),
                Column("data", String(50)),
                implicit_returning=False,
                schema=config.test_schema,
            )

    def test_insert_roundtrip(self):
        config.db.execute(self.tables.seq_pk.insert(), data="some data")
        self._assert_round_trip(self.tables.seq_pk, config.db)

    def test_insert_lastrowid(self):
        r = config.db.execute(self.tables.seq_pk.insert(), data="some data")
        eq_(r.inserted_primary_key, [1])

    def test_nextval_direct(self):
        r = config.db.execute(self.tables.seq_pk.c.id.default)
        eq_(r, 1)

    @requirements.sequences_optional
    def test_optional_seq(self):
        r = config.db.execute(
            self.tables.seq_opt_pk.insert(), data="some data"
        )
        eq_(r.inserted_primary_key, [1])

    def _assert_round_trip(self, table, conn):
        row = conn.execute(table.select()).first()
        eq_(row, (1, "some data"))

    def test_insert_roundtrip_no_implicit_returning(self, connection):
        connection.execute(
            self.tables.seq_no_returning.insert(), dict(data="some data")
        )
        self._assert_round_trip(self.tables.seq_no_returning, connection)

    @testing.combinations((True,), (False,), argnames="implicit_returning")
    @testing.requires.schemas
    def test_insert_roundtrip_translate(self, connection, implicit_returning):

        seq_no_returning = Table(
            "seq_no_returning_sch",
            MetaData(),
            Column(
                "id",
                Integer,
                Sequence("noret_sch_id_seq", schema="alt_schema"),
                primary_key=True,
            ),
            Column("data", String(50)),
            implicit_returning=implicit_returning,
            schema="alt_schema",
        )

        connection = connection.execution_options(
            schema_translate_map={"alt_schema": config.test_schema}
        )
        connection.execute(seq_no_returning.insert(), dict(data="some data"))
        self._assert_round_trip(seq_no_returning, connection)

    @testing.requires.schemas
    def test_nextval_direct_schema_translate(self, connection):
        seq = Sequence("noret_sch_id_seq", schema="alt_schema")
        connection = connection.execution_options(
            schema_translate_map={"alt_schema": config.test_schema}
        )

        r = connection.execute(seq)
        eq_(r, testing.db.dialect.default_sequence_base)


class SequenceCompilerTest(testing.AssertsCompiledSQL, fixtures.TestBase):
    __requires__ = ("sequences",)
    __backend__ = True

    def test_literal_binds_inline_compile(self):
        table = Table(
            "x",
            MetaData(),
            Column("y", Integer, Sequence("y_seq")),
            Column("q", Integer),
        )

        stmt = table.insert().values(q=5)

        seq_nextval = testing.db.dialect.statement_compiler(
            statement=None, dialect=testing.db.dialect
        ).visit_sequence(Sequence("y_seq"))
        self.assert_compile(
            stmt,
            "INSERT INTO x (y, q) VALUES (%s, 5)" % (seq_nextval,),
            literal_binds=True,
            dialect=testing.db.dialect,
        )


class HasSequenceTest(fixtures.TestBase):
    __requires__ = ("sequences",)
    __backend__ = True

    def test_has_sequence(self):
        s1 = Sequence("user_id_seq")
        testing.db.execute(schema.CreateSequence(s1))
        try:
            eq_(
                testing.db.dialect.has_sequence(testing.db, "user_id_seq"),
                True,
            )
        finally:
            testing.db.execute(schema.DropSequence(s1))

    @testing.requires.schemas
    def test_has_sequence_schema(self):
        s1 = Sequence("user_id_seq", schema=config.test_schema)
        testing.db.execute(schema.CreateSequence(s1))
        try:
            eq_(
                testing.db.dialect.has_sequence(
                    testing.db, "user_id_seq", schema=config.test_schema
                ),
                True,
            )
        finally:
            testing.db.execute(schema.DropSequence(s1))

    def test_has_sequence_neg(self):
        eq_(testing.db.dialect.has_sequence(testing.db, "user_id_seq"), False)

    @testing.requires.schemas
    def test_has_sequence_schemas_neg(self):
        eq_(
            testing.db.dialect.has_sequence(
                testing.db, "user_id_seq", schema=config.test_schema
            ),
            False,
        )

    @testing.requires.schemas
    def test_has_sequence_default_not_in_remote(self):
        s1 = Sequence("user_id_seq")
        testing.db.execute(schema.CreateSequence(s1))
        try:
            eq_(
                testing.db.dialect.has_sequence(
                    testing.db, "user_id_seq", schema=config.test_schema
                ),
                False,
            )
        finally:
            testing.db.execute(schema.DropSequence(s1))

    @testing.requires.schemas
    def test_has_sequence_remote_not_in_default(self):
        s1 = Sequence("user_id_seq", schema=config.test_schema)
        testing.db.execute(schema.CreateSequence(s1))
        try:
            eq_(
                testing.db.dialect.has_sequence(testing.db, "user_id_seq"),
                False,
            )
        finally:
            testing.db.execute(schema.DropSequence(s1))


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
11 Feb 2026 6.01 AM
root / root
0755
__pycache__
--
11 Feb 2026 6.01 AM
root / root
0755
__init__.py
0.35 KB
20 Jan 2026 1.01 PM
root / root
0644
test_cte.py
6.642 KB
20 Jan 2026 1.01 PM
root / root
0644
test_ddl.py
8.852 KB
20 Jan 2026 1.01 PM
root / root
0644
test_dialect.py
6.699 KB
20 Jan 2026 1.01 PM
root / root
0644
test_insert.py
9.445 KB
20 Jan 2026 1.01 PM
root / root
0644
test_reflection.py
47.257 KB
20 Jan 2026 1.01 PM
root / root
0644
test_results.py
10.714 KB
20 Jan 2026 1.01 PM
root / root
0644
test_select.py
23.821 KB
20 Jan 2026 1.01 PM
root / root
0644
test_sequence.py
6.809 KB
20 Jan 2026 1.01 PM
root / root
0644
test_types.py
36.29 KB
20 Jan 2026 1.01 PM
root / root
0644
test_update_delete.py
1.456 KB
20 Jan 2026 1.01 PM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF