From: Mike Bayer Date: Fri, 12 Jan 2024 14:29:28 +0000 (-0500) Subject: add Identity() for remaining examples X-Git-Tag: rel_2_0_26~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a25abbbeb0933d47b61b2614e578cf06b5cb78a1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add Identity() for remaining examples Fixed the performance example scripts in examples/performance to mostly work with the Oracle database, by adding the :class:`.Identity` construct to all the tables and allowing primary generation to occur on this backend. A few of the "raw DBAPI" cases still are not compatible with Oracle. Change-Id: I7ce19645ea78736dddfda6f33b9356ad75dee68f (cherry picked from commit 6e0a35dfd8bbd12c999abcae3309fe22e83b0444) --- diff --git a/doc/build/changelog/unreleased_20/examples.rst b/doc/build/changelog/unreleased_20/examples.rst new file mode 100644 index 0000000000..8ac2c567ed --- /dev/null +++ b/doc/build/changelog/unreleased_20/examples.rst @@ -0,0 +1,8 @@ +.. change:: + :tags: bug, examples + + Fixed the performance example scripts in examples/performance to mostly + work with the Oracle database, by adding the :class:`.Identity` construct + to all the tables and allowing primary generation to occur on this backend. + A few of the "raw DBAPI" cases still are not compatible with Oracle. + diff --git a/examples/performance/bulk_updates.py b/examples/performance/bulk_updates.py index c15d0f1672..8b782353df 100644 --- a/examples/performance/bulk_updates.py +++ b/examples/performance/bulk_updates.py @@ -5,6 +5,7 @@ of rows in bulk (under construction! there's just one test at the moment) """ from sqlalchemy import Column from sqlalchemy import create_engine +from sqlalchemy import Identity from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy.ext.declarative import declarative_base @@ -18,7 +19,7 @@ engine = None class Customer(Base): __tablename__ = "customer" - id = Column(Integer, primary_key=True) + id = Column(Integer, Identity(), primary_key=True) name = Column(String(255)) description = Column(String(255)) diff --git a/examples/performance/large_resultsets.py b/examples/performance/large_resultsets.py index 9c0d9fc4e2..b93459150e 100644 --- a/examples/performance/large_resultsets.py +++ b/examples/performance/large_resultsets.py @@ -15,6 +15,7 @@ provide a huge amount of functionality. """ from sqlalchemy import Column from sqlalchemy import create_engine +from sqlalchemy import Identity from sqlalchemy import Integer from sqlalchemy import String from sqlalchemy.ext.declarative import declarative_base @@ -29,7 +30,7 @@ engine = None class Customer(Base): __tablename__ = "customer" - id = Column(Integer, primary_key=True) + id = Column(Integer, Identity(), primary_key=True) name = Column(String(255)) description = Column(String(255)) diff --git a/examples/performance/short_selects.py b/examples/performance/short_selects.py index d0e5f6e9d2..553c2fed5f 100644 --- a/examples/performance/short_selects.py +++ b/examples/performance/short_selects.py @@ -8,6 +8,7 @@ import random from sqlalchemy import bindparam from sqlalchemy import Column from sqlalchemy import create_engine +from sqlalchemy import Identity from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy import String @@ -28,7 +29,7 @@ ids = range(1, 11000) class Customer(Base): __tablename__ = "customer" - id = Column(Integer, primary_key=True) + id = Column(Integer, Identity(), primary_key=True) name = Column(String(255)) description = Column(String(255)) q = Column(Integer) diff --git a/examples/performance/single_inserts.py b/examples/performance/single_inserts.py index 991d213a07..904fda2d03 100644 --- a/examples/performance/single_inserts.py +++ b/examples/performance/single_inserts.py @@ -7,6 +7,7 @@ a database connection, inserts the row, commits and closes. from sqlalchemy import bindparam from sqlalchemy import Column from sqlalchemy import create_engine +from sqlalchemy import Identity from sqlalchemy import Integer from sqlalchemy import pool from sqlalchemy import String @@ -21,7 +22,7 @@ engine = None class Customer(Base): __tablename__ = "customer" - id = Column(Integer, primary_key=True) + id = Column(Integer, Identity(), primary_key=True) name = Column(String(255)) description = Column(String(255))