33Features
44========
55
6+ Autoincremented Columns
7+ -----------------------
8+
9+ In SQLAlchemy-Exasol, the autoincrement feature leverages Exasol's native
10+ `IDENTITY <https://docs.exasol.com/db/latest/sql_references/data_types/identitycolumns.htm >`__
11+ columns to automatically generate unique, sequential primary key values. To enable this
12+ behavior when defining a table, set ``primary_key=True `` as shown in the following examples:
13+
14+ * :ref: `Create Table <example_non_orm_create_table >`
15+ * :ref: `Create Table with ORM <example_orm_create_table >`
16+
17+ Once configured, Exasol generates a new ID on the server side whenever a new row is
18+ inserted.
19+
20+ Automatic Indexes
21+ -----------------
22+
23+ Exasol is a self-tuning database designed to eliminate the manual effort of performance
24+ optimization. Instead of requiring users to design and maintain indexes, the database
25+ engine intelligently generates and updates them on the fly during query execution to ensure
26+ optimal join and filter performance.
27+
28+ For SQLALchemy-Exasol users, this means:
29+
30+ * **Simplified Development **: You are free from the burden of manual index
31+ management; the database handles it all for you.
32+ * **Automatic Performance **: Efficient indexes are created precisely when needed and
33+ are automatically maintained or discarded based on usage.
34+ * **Optimized Storage **: Indexes are only persisted upon a successful transaction
35+ commit, keeping your database clean and efficient.
36+
37+ Because Exasol provides this built-in auto-tuning, manual index creation is not only
38+ unnecessary but intentionally unsupported to prevent interference with the engine's
39+ optimization algorithms. For more in-depth information, explore the Exasol documentation
40+ on `indexes <https://docs.exasol.com/db/latest/performance/indexes.htm >`__.
41+
42+ Foreign Keys
43+ ------------
44+
45+ By default, Exasol does not enforce foreign keys or primary keys. Instead, they are
46+ primarily used as metadata to help the query optimizer create faster execution plans:
47+
48+ * **Default State **: By default, constraints are created in a ``DISABLE `` state. This
49+ means you can insert data that violates referential integrity without the database
50+ stopping you.
51+ * **Enforcement Setting **: To prevent invalid data from being inserted, you can
52+ explicitly set the constraint to ``ENABLE ``.
53+ * **Performance Impact **: Exasol leaves them disabled by default because strict
54+ enforcement adds overhead during high-speed data loading (DML operations).
55+
56+ To see the status of your foreign key columns, check table
57+ `EXA_ALL_CONSTRAINTS <https://docs.exasol.com/db/latest/sql_references/system_tables/metadata/exa_all_constraints.htm >`__.
58+
59+ To check what your system settings are, use this SQL statement:
60+
61+ .. code-block :: sql
62+
63+ SELECT * FROM EXA_PARAMETERS
64+ WHERE PARAMETER_NAME = 'CONSTRAINT_STATE_DEFAULT';
65+
66+
67+ To check a foreign key constraint without switching the constraint to ``ENABLE ``, see
68+ `Verification of the Foreign Key Property <https://docs.exasol.com/db/latest/sql/foreignkey.htm >`__.
69+
70+ To switch a constraint to ``ENABLE ``, choose which SQL statement suits your purposes best:
71+
72+ .. code-block :: sql
73+
74+ -- For a specific constraint
75+ ALTER TABLE <table_name> MODIFY CONSTRAINT <constraint_name> ENABLE;
76+
77+ -- For global enforcement, which will degrade performance
78+ ALTER SYSTEM SET DEFAULT_CONSTRAINT_STATE = 'ENABLE';
79+
80+
681 .. _orm :
782
883Object-Relational Mapping
@@ -17,7 +92,7 @@ that ensures data consistency.
1792
1893.. note ::
1994
20- * To get started, check out our :ref: `examples_orm `.
95+ * To get started, check out our :ref: `ORM Examples < examples_orm > `.
2196 * For more examples & details, see SQLAlchemy's
2297 `ORM Quick Start <https://docs.sqlalchemy.org/en/20/orm/quickstart.html >`__
2398 and `ORM Index <https://docs.sqlalchemy.org/en/20/orm/index.html >`__.
0 commit comments