Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOP-15764] - add jdbc option classes #277

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions docs/connection/db_connection/clickhouse/execute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use ``Clickhouse.fetch``
Use this method to perform some ``SELECT`` query which returns **small number or rows**, like reading
Clickhouse config, or reading data from some reference table. Method returns Spark DataFrame.

Method accepts :obj:`FetchOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCFetchOptions>`.
Method accepts :obj:`Clickhouse.FetchOptions <onetl.connection.db_connection.clickhouse.options.ClickhouseFetchOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -60,7 +60,7 @@ Use ``Clickhouse.execute``

Use this method to execute DDL and DML operations. Each method call runs operation in a separated transaction, and then commits it.

Method accepts :obj:`ExecuteOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCExecuteOptions>`.
Method accepts :obj:`Clickhouse.ExecuteOptions <onetl.connection.db_connection.clickhouse.options.ClickhouseExecuteOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -111,15 +111,17 @@ So it should **NOT** be used to read large amounts of data. Use :ref:`DBReader <
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_mixin.options
.. currentmodule:: onetl.connection.db_connection.clickhouse.options

.. autopydantic_model:: JDBCFetchOptions
.. autopydantic_model:: ClickhouseFetchOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false


.. autopydantic_model:: JDBCExecuteOptions
.. autopydantic_model:: ClickhouseExecuteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
7 changes: 4 additions & 3 deletions docs/connection/db_connection/clickhouse/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Supported DBReader features
* * ✅︎ :ref:`incremental-batch-strategy`
* ❌ ``hint`` (is not supported by Clickhouse)
* ❌ ``df_schema``
* ✅︎ ``options`` (see :obj:`JDBCReadOptions <onetl.connection.db_connection.jdbc.options.JDBCReadOptions>`)
* ✅︎ ``options`` (see :obj:`Clickhouse.ReadOptions <onetl.connection.db_connection.clickhouse.options.ClickhouseReadOptions>`)

Examples
--------
Expand Down Expand Up @@ -85,9 +85,10 @@ Especially if there are indexes or partitions for columns used in ``where`` clau
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.clickhouse.options

.. autopydantic_model:: JDBCReadOptions
.. autopydantic_model:: ClickhouseReadOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
8 changes: 6 additions & 2 deletions docs/connection/db_connection/clickhouse/sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ Especially if there are indexes or partitions for columns used in ``where`` clau
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.clickhouse.options

.. autopydantic_model:: JDBCSQLOptions
.. autopydantic_model:: ClickhouseSQLOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
7 changes: 4 additions & 3 deletions docs/connection/db_connection/clickhouse/write.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ Examples
Options
-------

Method above accepts :obj:`JDBCWriteOptions <onetl.connection.db_connection.jdbc.options.JDBCWriteOptions>`
Method above accepts :obj:`Clickhouse.WriteOptions <onetl.connection.db_connection.clickhouse.options.ClickhouseWriteOptions>`

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.clickhouse.options

.. autopydantic_model:: JDBCWriteOptions
.. autopydantic_model:: ClickhouseWriteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
12 changes: 7 additions & 5 deletions docs/connection/db_connection/greenplum/execute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use ``Greenplum.fetch``
Use this method to perform some ``SELECT`` query which returns **small number or rows**, like reading
Greenplum config, or reading data from some reference table. Method returns Spark DataFrame.

Method accepts :obj:`FetchOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCFetchOptions>`.
Method accepts :obj:`Greenplum.FetchOptions <onetl.connection.db_connection.greenplum.options.GreenplumFetchOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -60,7 +60,7 @@ Use ``Greenplum.execute``

Use this method to execute DDL and DML operations. Each method call runs operation in a separated transaction, and then commits it.

Method accepts :obj:`ExecuteOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCExecuteOptions>`.
Method accepts :obj:`Greenplum.ExecuteOptions <onetl.connection.db_connection.greenplum.options.GreenplumExecuteOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -143,15 +143,17 @@ The only port used while interacting with Greenplum in this case is ``5432`` (Gr
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_mixin.options
.. currentmodule:: onetl.connection.db_connection.greenplum.options

.. autopydantic_model:: JDBCFetchOptions
.. autopydantic_model:: GreenplumFetchOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false


.. autopydantic_model:: JDBCExecuteOptions
.. autopydantic_model:: GreenplumExecuteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
2 changes: 1 addition & 1 deletion docs/connection/db_connection/greenplum/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Supported DBReader features
* * ✅︎ :ref:`incremental-batch-strategy`
* ❌ ``hint`` (is not supported by Greenplum)
* ❌ ``df_schema``
* ✅︎ ``options`` (see :obj:`GreenplumReadOptions <onetl.connection.db_connection.greenplum.options.GreenplumReadOptions>`)
* ✅︎ ``options`` (see :obj:`Greenplum.ReadOptions <onetl.connection.db_connection.greenplum.options.GreenplumReadOptions>`)

.. warning::

Expand Down
2 changes: 1 addition & 1 deletion docs/connection/db_connection/kafka/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Supported DBReader features
* * ❌ :ref:`incremental-batch-strategy`
* ❌ ``hint`` (is not supported by Kafka)
* ❌ ``df_schema`` (see note below)
* ✅︎ ``options`` (see :obj:`KafkaReadOptions <onetl.connection.db_connection.kafka.options.KafkaReadOptions>`)
* ✅︎ ``options`` (see :obj:`Kafka.ReadOptions <onetl.connection.db_connection.kafka.options.KafkaReadOptions>`)

Dataframe schema
----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/connection/db_connection/mongodb/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Supported DBReader features
* * Note that ``expression`` field of HWM can only be a field name, not a custom expression
* ✅︎ ``hint`` (see `official documentation <https://www.mongodb.com/docs/v5.0/reference/operator/meta/hint/>`_)
* ✅︎ ``df_schema`` (mandatory)
* ✅︎ ``options`` (see :obj:`MongoDBReadOptions <onetl.connection.db_connection.mongodb.options.MongoDBReadOptions>`)
* ✅︎ ``options`` (see :obj:`MongoDB.ReadOptions <onetl.connection.db_connection.mongodb.options.MongoDBReadOptions>`)

Examples
--------
Expand Down
2 changes: 1 addition & 1 deletion docs/connection/db_connection/mongodb/write.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Examples
Write options
-------------

Method above accepts :obj:`JDBCWriteOptions <onetl.connection.db_connection.mongodb.options.MongoDBWriteOptions>`
Method above accepts :obj:`MongoDB.WriteOptions <onetl.connection.db_connection.mongodb.options.MongoDBWriteOptions>`

.. currentmodule:: onetl.connection.db_connection.mongodb.options

Expand Down
13 changes: 7 additions & 6 deletions docs/connection/db_connection/mssql/execute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use ``MSSQL.fetch``
Use this method to perform some ``SELECT`` query which returns **small number or rows**, like reading
MSSQL config, or reading data from some reference table. Method returns Spark DataFrame.

Method accepts :obj:`FetchOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCFetchOptions>`.
Method accepts :obj:`MSSQL.FetchOptions <onetl.connection.db_connection.mssql.options.MSSQLFetchOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -59,7 +59,7 @@ Use ``MSSQL.execute``

Use this method to execute DDL and DML operations. Each method call runs operation in a separated transaction, and then commits it.

Method accepts :obj:`ExecuteOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCExecuteOptions>`.
Method accepts :obj:`MSSQL.ExecuteOptions <onetl.connection.db_connection.mssql.options.MSSQLExecuteOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -103,15 +103,16 @@ Examples
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_mixin.options
.. currentmodule:: onetl.connection.db_connection.mssql.options

.. autopydantic_model:: JDBCFetchOptions
.. autopydantic_model:: MSSQLFetchOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false


.. autopydantic_model:: JDBCExecuteOptions
.. autopydantic_model:: MSSQLExecuteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
7 changes: 4 additions & 3 deletions docs/connection/db_connection/mssql/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Supported DBReader features
* * ✅︎ :ref:`incremental-batch-strategy`
* ❌ ``hint`` (MSSQL does support hints, but DBReader not, at least for now)
* ❌ ``df_schema``
* ✅︎ ``options`` (see :obj:`JDBCReadOptions <onetl.connection.db_connection.jdbc.options.JDBCReadOptions>`)
* ✅︎ ``options`` (see :obj:`MSSQL.ReadOptions <onetl.connection.db_connection.mssql.options.MSSQLReadOptions>`)

Examples
--------
Expand Down Expand Up @@ -85,9 +85,10 @@ Especially if there are indexes or partitions for columns used in ``where`` clau
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.mssql.options

.. autopydantic_model:: JDBCReadOptions
.. autopydantic_model:: MSSQLReadOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
10 changes: 7 additions & 3 deletions docs/connection/db_connection/mssql/sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Examples
WHERE
key = 'something'
""",
options=MSSQL.QLOptions(
options=MSSQL.SQLOptions(
partition_column="id",
num_partitions=10,
lower_bound=0,
Expand All @@ -70,6 +70,10 @@ Especially if there are indexes or partitions for columns used in ``where`` clau
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.mssql.options

.. autopydantic_model:: JDBCSQLOptions
.. autopydantic_model:: MSSQLSQLOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
7 changes: 4 additions & 3 deletions docs/connection/db_connection/mssql/write.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ Examples
Options
-------

Method above accepts :obj:`JDBCWriteOptions <onetl.connection.db_connection.jdbc.options.JDBCWriteOptions>`
Method above accepts :obj:`MSSQL.WriteOptions <onetl.connection.db_connection.mssql.options.MSSQLWriteOptions>`

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.mssql.options

.. autopydantic_model:: JDBCWriteOptions
.. autopydantic_model:: MSSQLWriteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
16 changes: 7 additions & 9 deletions docs/connection/db_connection/mysql/execute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use ``MySQL.fetch``
Use this method to perform some ``SELECT`` query which returns **small number or rows**, like reading
MySQL config, or reading data from some reference table. Method returns Spark DataFrame.

Method accepts :obj:`FetchOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCFetchOptions>`.
Method accepts :obj:`MySQL.FetchOptions <onetl.connection.db_connection.mysql.options.MySQLFetchOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -60,7 +60,7 @@ Use ``MySQL.execute``

Use this method to execute DDL and DML operations. Each method call runs operation in a separated transaction, and then commits it.

Method accepts :obj:`ExecuteOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCExecuteOptions>`.
Method accepts :obj:`MySQL.ExecuteOptions <onetl.connection.db_connection.mysql.options.MySQLExecuteOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -104,15 +104,13 @@ Examples
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_mixin.options
.. currentmodule:: onetl.connection.db_connection.mysql.options

.. autopydantic_model:: JDBCFetchOptions
.. autopydantic_model:: MySQLFetchOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false


.. autopydantic_model:: JDBCExecuteOptions
.. autopydantic_model:: MySQLExecuteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
9 changes: 4 additions & 5 deletions docs/connection/db_connection/mysql/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Supported DBReader features
* * ✅︎ :ref:`incremental-batch-strategy`
* ✅︎ ``hint`` (see `official documentation <https://dev.mysql.com/doc/refman/en/optimizer-hints.html>`_)
* ❌ ``df_schema``
* ✅︎ ``options`` (see :obj:`JDBCReadOptions <onetl.connection.db_connection.jdbc.options.JDBCReadOptions>`)
* ✅︎ ``options`` (see :obj:`MySQL.ReadOptions <onetl.connection.db_connection.mysql.options.MySQLReadOptions>`)

Examples
--------
Expand Down Expand Up @@ -87,9 +87,8 @@ Especially if there are indexes for columns used in ``where`` clause.
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.mysql.options

.. autopydantic_model:: JDBCReadOptions
.. autopydantic_model:: MySQLReadOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
8 changes: 6 additions & 2 deletions docs/connection/db_connection/mysql/sql.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Especially if there are indexes or partitions for columns used in ``where`` clau
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.mysql.options

.. autopydantic_model:: JDBCSQLOptions
.. autopydantic_model:: MySQLSQLOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
7 changes: 4 additions & 3 deletions docs/connection/db_connection/mysql/write.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ Examples
Options
-------

Method above accepts :obj:`JDBCWriteOptions <onetl.connection.db_connection.jdbc.options.JDBCWriteOptions>`
Method above accepts :obj:`MySQL.WriteOptions <onetl.connection.db_connection.mysql.options.MySQLWriteOptions>`

.. currentmodule:: onetl.connection.db_connection.jdbc_connection.options
.. currentmodule:: onetl.connection.db_connection.mysql.options

.. autopydantic_model:: JDBCWriteOptions
.. autopydantic_model:: MySQLWriteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
16 changes: 7 additions & 9 deletions docs/connection/db_connection/oracle/execute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Use ``Oracle.fetch``
Use this method to execute some ``SELECT`` query which returns **small number or rows**, like reading
Oracle config, or reading data from some reference table. Method returns Spark DataFrame.

Method accepts :obj:`FetchOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCFetchOptions>`.
Method accepts :obj:`Oracle.FetchOptions <onetl.connection.db_connection.oracle.options.OracleFetchOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -60,7 +60,7 @@ Use ``Oracle.execute``

Use this method to execute DDL and DML operations. Each method call runs operation in a separated transaction, and then commits it.

Method accepts :obj:`ExecuteOptions <onetl.connection.db_connection.jdbc_mixin.options.JDBCExecuteOptions>`.
Method accepts :obj:`Oracle.ExecuteOptions <onetl.connection.db_connection.oracle.options.OracleExecuteOptions>`.

Connection opened using this method should be then closed with ``connection.close()`` or ``with connection:``.

Expand Down Expand Up @@ -104,15 +104,13 @@ Examples
Options
-------

.. currentmodule:: onetl.connection.db_connection.jdbc_mixin.options
.. currentmodule:: onetl.connection.db_connection.oracle.options

.. autopydantic_model:: JDBCFetchOptions
.. autopydantic_model:: OracleFetchOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false


.. autopydantic_model:: JDBCExecuteOptions
.. autopydantic_model:: OracleExecuteOptions
:inherited-members: GenericOptions
:member-order: bysource
:model-show-field-summary: false
:field-show-constraints: false
Loading