Implementations for sync-related driver multimethods for SQL JDBC drivers, using JDBC DatabaseMetaData.
Implementations for sync-related driver multimethods for SQL JDBC drivers, using JDBC DatabaseMetaData.
(active-tables driver metadata)
Return a set of maps containing information about the active tables/views, collections, or equivalent that currently
exist in a database. Each map should contain the key :name
, which is the string name of the table. For databases
that have a concept of schemas, this map should also include the string name of the table's :schema
.
Two different implementations are provided in this namespace: fast-active-tables
(the default), and
post-filtered-active-tables
. You should be fine using the default, but refer to the documentation for those
functions for more details on the differences.
metabase
is an instance of DatabaseMetaData
.
Return a set of maps containing information about the active tables/views, collections, or equivalent that currently exist in a database. Each map should contain the key `:name`, which is the string name of the table. For databases that have a concept of schemas, this map should also include the string name of the table's `:schema`. Two different implementations are provided in this namespace: `fast-active-tables` (the default), and `post-filtered-active-tables`. You should be fine using the default, but refer to the documentation for those functions for more details on the differences. `metabase` is an instance of `DatabaseMetaData`.
(add-table-pks metadata table)
Using metadata
find any primary keys for table
and assoc :pk?
to true for those columns.
Using `metadata` find any primary keys for `table` and assoc `:pk?` to true for those columns.
(column->special-type driver database-type column-name)
Attempt to determine the special-type of a field given the column name and native type. For example, the Postgres
driver can mark Postgres JSON type columns as :type/SerializedJSON
special type.
database-type
and column-name
will be strings.
Attempt to determine the special-type of a field given the column name and native type. For example, the Postgres driver can mark Postgres JSON type columns as `:type/SerializedJSON` special type. `database-type` and `column-name` will be strings.
(database-type->base-type driver database-type)
Given a native DB column type (as a keyword), return the corresponding Field
base-type
, which should derive from
:type/*
. You can use pattern-based-database-type->base-type
in this namespace to implement this using regex patterns.
Given a native DB column type (as a keyword), return the corresponding `Field` `base-type`, which should derive from `:type/*`. You can use `pattern-based-database-type->base-type` in this namespace to implement this using regex patterns.
(describe-database driver db-or-id-or-spec)
Default implementation of driver/describe-database
for SQL JDBC drivers. Uses JDBC DatabaseMetaData.
Default implementation of `driver/describe-database` for SQL JDBC drivers. Uses JDBC DatabaseMetaData.
(describe-table driver db-or-id-or-spec table)
Default implementation of driver/describe-table
for SQL JDBC drivers. Uses JDBC DatabaseMetaData.
Default implementation of `driver/describe-table` for SQL JDBC drivers. Uses JDBC DatabaseMetaData.
(describe-table-fields metadata
driver
{schema :schema table-name :name}
&
[db-name-or-nil])
Returns a set of column metadata for schema
and table-name
using metadata
.
Returns a set of column metadata for `schema` and `table-name` using `metadata`.
(describe-table-fks driver db-or-id-or-spec table & [db-name-or-nil])
Default implementation of driver/describe-table-fks
for SQL JDBC drivers. Uses JDBC DatabaseMetaData.
Default implementation of `driver/describe-table-fks` for SQL JDBC drivers. Uses JDBC DatabaseMetaData.
(excluded-schemas driver)
Return set of string names of schemas to skip syncing tables from.
Return set of string names of schemas to skip syncing tables from.
(fast-active-tables driver metadata & [db-name-or-nil])
Default, fast implementation of ISQLDriver/active-tables
best suited for DBs with lots of system tables (like
Oracle). Fetch list of schemas, then for each one not in excluded-schemas
, fetch its Tables, and combine the
results.
This is as much as 15x faster for Databases with lots of system tables than post-filtered-active-tables
(4
seconds vs 60).
Default, fast implementation of `ISQLDriver/active-tables` best suited for DBs with lots of system tables (like Oracle). Fetch list of schemas, then for each one not in `excluded-schemas`, fetch its Tables, and combine the results. This is as much as 15x faster for Databases with lots of system tables than `post-filtered-active-tables` (4 seconds vs 60).
(get-catalogs metadata)
Returns a set of all of the catalogs found via metadata
Returns a set of all of the catalogs found via `metadata`
(pattern-based-database-type->base-type pattern->type)
Return a database-type->base-type
function that matches types based on a sequence of pattern / base-type pairs.
Return a `database-type->base-type` function that matches types based on a sequence of pattern / base-type pairs.
(post-filtered-active-tables driver metadata & [db-name-or-nil])
Alternative implementation of ISQLDriver/active-tables
best suited for DBs with little or no support for schemas.
Fetch all Tables, then filter out ones whose schema is in excluded-schemas
Clojure-side.
Alternative implementation of `ISQLDriver/active-tables` best suited for DBs with little or no support for schemas. Fetch *all* Tables, then filter out ones whose schema is in `excluded-schemas` Clojure-side.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close