Skip to content

Commit 716740b

Browse files
committed
feat(format): add constraint_expression to GetObjects
Closes #3987.
1 parent 4248d7c commit 716740b

File tree

2 files changed

+228
-16
lines changed
  • c/include/arrow-adbc
  • go/adbc/drivermgr/arrow-adbc

2 files changed

+228
-16
lines changed

c/include/arrow-adbc/adbc.h

Lines changed: 114 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,10 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream
545545
/// \see ADBC_VERSION_1_2_0
546546
#define ADBC_INFO_DRIVER_ADBC_VERSION 103
547547

548+
/// \defgroup adbc-catalog-metadata ADBC Catalog Metadata Constants
549+
/// Constants for catalog metadata.
550+
/// @{
551+
548552
/// \brief Return metadata on catalogs, schemas, tables, and columns.
549553
///
550554
/// \see AdbcConnectionGetObjects
@@ -570,6 +574,72 @@ const struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream
570574
/// \see AdbcConnectionGetObjects
571575
#define ADBC_OBJECT_DEPTH_COLUMNS ADBC_OBJECT_DEPTH_ALL
572576

577+
/// \brief This foreign key does not allow update of the corresponding primary
578+
/// key.
579+
///
580+
/// \see AdbcConnectionGetObjects
581+
#define ADBC_CONSTRAINT_ACTION_NO_ACTION 3
582+
583+
/// \brief This foreign key will be updated/deleted with corresponding primary
584+
/// key.
585+
///
586+
/// \see AdbcConnectionGetObjects
587+
#define ADBC_CONSTRAINT_ACTION_CASCADE 0
588+
589+
/// \brief This foreign key will be set to NULL if its corresponding primary
590+
/// key is updated or deleted.
591+
///
592+
/// \see AdbcConnectionGetObjects
593+
#define ADBC_CONSTRAINT_ACTION_SET_NULL 2
594+
595+
/// \brief This foreign key will be set to its default if its corresponding
596+
/// primary key is updated or deleted.
597+
///
598+
/// \see AdbcConnectionGetObjects
599+
#define ADBC_CONSTRAINT_ACTION_SET_DEFAULT 4
600+
601+
/// \brief Similar to ADBC_CONSTRAINT_ACTION_NO_ACTION but may be interpreted
602+
/// differently by the vendor (e.g., raise an error immediately instead of
603+
/// allowing the check to be deferred).
604+
///
605+
/// \see AdbcConnectionGetObjects
606+
#define ADBC_CONSTRAINT_ACTION_RESTRICT 1
607+
608+
/// \brief This constraint is deferrable, and is initially deferred.
609+
///
610+
/// \see AdbcConnectionGetObjects
611+
#define ADBC_CONSTRAINT_DEFERRABLE_DEFERRED 5
612+
613+
/// \brief This constraint is deferrable, but is initially immediate.
614+
///
615+
/// \see AdbcConnectionGetObjects
616+
#define ADBC_CONSTRAINT_DEFERRABLE_IMMEDIATE 6
617+
618+
/// \brief This constraint may not be deferred.
619+
///
620+
/// \see AdbcConnectionGetObjects
621+
#define ADBC_CONSTRAINT_NOT_DEFERRABLE 7
622+
623+
/// \brief This foreign key allows any of the foreign key columns to be NULL;
624+
/// if so, no match is required in the referenced table.
625+
///
626+
/// \see AdbcConnectionGetObjects
627+
#define ADBC_CONSTRAINT_MATCH_SIMPLE 0
628+
629+
/// \brief This foreign key only allows foreign key columns to be NULL if all
630+
/// of them are NULL; if so, no match is required in the referenced table.
631+
///
632+
/// \see AdbcConnectionGetObjects
633+
#define ADBC_CONSTRAINT_MATCH_FULL 1
634+
635+
/// \brief This foreign key allows any of the foreign key columns to be NULL;
636+
/// if so, non-NULL columns must still match.
637+
///
638+
/// \see AdbcConnectionGetObjects
639+
#define ADBC_CONSTRAINT_MATCH_PARTIAL 2
640+
641+
/// @}
642+
573643
/// \defgroup adbc-table-statistics ADBC Statistic Types
574644
/// Standard statistic names for AdbcConnectionGetStatistics.
575645
/// @{
@@ -1766,20 +1836,56 @@ AdbcStatusCode AdbcConnectionGetInfo(struct AdbcConnection* connection,
17661836
/// | constraint_type | utf8 not null | (1) |
17671837
/// | constraint_column_names | list<utf8> not null | (2) |
17681838
/// | constraint_column_usage | list<USAGE_SCHEMA> | (3) |
1769-
///
1770-
/// 1. One of 'CHECK', 'FOREIGN KEY', 'PRIMARY KEY', or 'UNIQUE'.
1839+
/// | constraint_expression | utf8 | (4) |
1840+
/// | constraint_update_rule | int16 | (5) |
1841+
/// | constraint_delete_rule | int16 | (5) |
1842+
/// | constraint_enforced | bool | (6) |
1843+
/// | constraint_deferrability | int16 | (7) |
1844+
/// | constraint_match_type | int16 | (8) |
1845+
///
1846+
/// 1. One of 'CHECK', 'FOREIGN KEY', 'PRIMARY KEY', or 'UNIQUE', or a
1847+
/// vendor-specific type.
17711848
/// 2. The columns on the current table that are constrained, in
17721849
/// order.
17731850
/// 3. For FOREIGN KEY only, the referenced table and columns.
1851+
/// 4. [Since version 1.2.0] The vendor-specific definition of the constraint
1852+
/// (e.g. the SQL expression to be checked). This field is optional.
1853+
/// 5. [Since version 1.2.0] The action to be taken when the primary key is
1854+
/// updated or deleted. The value is one of the ADBC_CONSTRAINT_ACTION_
1855+
/// constants. This field is optional.
1856+
/// 6. [Since version 1.2.0] Whether the constraint is currently enabled.
1857+
/// This field is optional.
1858+
/// 7. [Since version 1.2.0] Whether the constraint can be deferred, and if
1859+
/// so, whether it starts deferred. The value is one of the
1860+
/// ADBC_CONSTRAINT_DEFERRABLE_ constants or
1861+
/// ADBC_CONSTRAINT_NOT_DEFERRABLE. This field is optional.
1862+
/// 8. [Since version 1.2.0] How the foreign key constraint should be matched.
1863+
/// The value is one of the ADBC_CONSTRAINT_MATCH_ constants. This field
1864+
/// is optional.
17741865
///
17751866
/// USAGE_SCHEMA is a Struct with fields:
17761867
///
1777-
/// | Field Name | Field Type |
1778-
/// |--------------------------|-------------------------|
1779-
/// | fk_catalog | utf8 |
1780-
/// | fk_db_schema | utf8 |
1781-
/// | fk_table | utf8 not null |
1782-
/// | fk_column_name | utf8 not null |
1868+
/// | Field Name | Field Type | Comments |
1869+
/// |--------------------------|-------------------------|----------|
1870+
/// | fk_catalog | utf8 | |
1871+
/// | fk_db_schema | utf8 | |
1872+
/// | fk_table | utf8 not null | |
1873+
/// | fk_column_name | utf8 not null | |
1874+
/// | fk_key_seq | int32 not null | (1) |
1875+
/// | fk_pk_name | utf8 | (2) |
1876+
///
1877+
/// 1. [Since version 1.2.0] The ordinal position of the column within the
1878+
/// foreign key. If present, the driver should sort the rows on this
1879+
/// column. This field is optional.
1880+
/// 2. [Since version 1.2.0] The name of the referenced primary key. This
1881+
/// field is optional.
1882+
///
1883+
/// Starting in version 1.2.0, optional fields were introduced to the schema.
1884+
/// Optional fields may not be present and applications should check before
1885+
/// using them. Drivers may choose to include optional fields (with null
1886+
/// values) even if not supported, but are not required to. If an optional
1887+
/// field is present, all optional fields defined before it in the schema must
1888+
/// be present.
17831889
///
17841890
/// This AdbcConnection must outlive the returned ArrowArrayStream.
17851891
///

go/adbc/drivermgr/arrow-adbc/adbc.h

Lines changed: 114 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)