Liking cljdoc? Tell your friends :D

org.purefn.sqlium.import


all-ids-queryclj

(all-ids-query spec)

Returns a query that will select all ids in the base table of spec.

Returns a query that will select all ids in the base table of
spec.
raw docstring

condition-tableclj

(condition-table condition)

Returns the table used in a condition's column.

Returns the table used in a condition's column.
raw docstring

default-batch-sizeclj


delta-conditionclj

(delta-condition field date)

Returns condition map for a delta field.

Returns condition map for a delta field.
raw docstring

expiry-conditionclj

(expiry-condition expiry)

Returns condition map for an expiry.

Returns condition map for an expiry.
raw docstring

fetch-columnclj

(fetch-column db query column)

Efficient, low-level query function to return a collection of a single column. Takes a sql query, the column name to fetch, and returns an ArrayList with the values of that column.

Efficient, low-level query function to return a collection of a
single column. Takes a sql query, the column name to fetch, and
returns an ArrayList with the values of that column.
raw docstring

fetch-resultsclj

(fetch-results db sql-with-aliases)

Takes the [sql col-aliases] tuple as returned by sql/select and fetches the results, renaming the keys in the returned records using col-aliases.

Takes the [sql col-aliases] tuple as returned by `sql/select` and
fetches the results, renaming the keys in the returned records
using col-aliases.
raw docstring

id-queryclj

(id-query spec {:keys [limit offset delta expiry] :as opts})

Takes parsed spec (not grouped) and returns query to retrieve the ids, controlled by opts map.

Takes parsed spec (not grouped) and returns query to retrieve the
ids, controlled by opts map.
raw docstring

import-many-relationshipclj

(import-many-relationship db rel data)

Takes a db, a many relationship map and collection of source table data, retrieves the related data and merges it into the table data.

Takes a db, a many relationship map and collection of source table data,
retrieves the related data and merges it into the table data.
raw docstring

import-recordclj

(import-record db table-spec entid)

Like import-table, but returns single record from given db.

Like import-table, but returns single record from given db.
raw docstring

import-tableclj

(import-table db table-spec)
(import-table db
              table-spec
              {:keys [limit offset delta expiry batch update-table]
               :or {batch default-batch-size}
               :as opts})

Takes an analyzed DSL spec with a table at the top level, and opts map, and performs the queries to fetch the table data and its associated relationships. opts map has keys:

  • :limit Number of records to retrieve [unlimited]
  • :offset Starting record [0]
  • :delta Turns the import into a deltas import. A map with parameters for retrieving deltas.
  • :update-table Also turns into ino a deltas import. Preferred over :delta, if present. A map describing the table that contains entity ids to update.
  • :expiry Spec for filter for records older than a specified number of days.
  • :batch Batch size.

If present, the delta map should have keys:

  • :fields Collection of :table/column (datetime) fields that will be used for update detection.
  • :date Date to be used for comparison. Anything that clj-time can coerce to DateTime.

If present, the update-table map should have keys:

  • :table Name of the update table
  • :id Name of column with entity ids
  • :updated Name of column with entity update datetimes.
  • :since Datetime to return updates since.

If present, the expiry map should have keys:

  • :field The :table/column (datetime) field that will be used to determine record age.
  • :age DateTime of the cutoff.

The resulting records have keys in the form of :table/column for each group, and many-relationships in [:many-relationships :foreign-table/column] keys.

Returns a lazy-seq of results.

Takes an analyzed DSL spec with a table at the top level, and opts
map, and performs the queries to fetch the table data and its
associated relationships. opts map has keys:

 * :limit   Number of records to retrieve [unlimited]
 * :offset  Starting record [0]
 * :delta   Turns the import into a deltas import. A map with
            parameters for retrieving deltas.
 * :update-table  Also turns into ino a deltas import. Preferred
            over :delta, if present. A map describing the table
            that contains entity ids to update.
 * :expiry  Spec for filter for records older than a specified
            number of days.
 * :batch   Batch size.

If present, the delta map should have keys:
 * :fields  Collection of :table/column (datetime) fields that will
            be used for update detection.
 * :date    Date to be used for comparison. Anything that clj-time can
            coerce to DateTime.

If present, the update-table map should have keys:
 * :table     Name of the update table
 * :id        Name of column with entity ids
 * :updated   Name of column with entity update datetimes.
 * :since     Datetime to return updates since.

If present, the expiry map should have keys:
 * :field   The :table/column (datetime) field that will be used to
            determine record age.
 * :age     DateTime of the cutoff.

The resulting records have keys in the form of :table/column for
each group, and many-relationships
in [:many-relationships :foreign-table/column] keys.

Returns a lazy-seq of results.
raw docstring

join-pathclj

(join-path path)

Takes a path (as from table-paths) and returns collection of maps describing each join in the path, containing:

{:base {:name "table-name" :alias "optional-alias" :join-col "col-name"} :target {:name "table-name" :alias "table-alias" :join-col "col-name"}

Table aliases are used so that tables can be repeated in a relationship chain. The aliases are generated by appending an incrementing number to the table name.

Takes a path (as from table-paths) and returns collection of maps
describing each join in the path, containing:

`{:base {:name "table-name"
         :alias "optional-alias"
         :join-col "col-name"}
  :target {:name "table-name"
           :alias "table-alias"
           :join-col "col-name"}`

Table aliases are used so that tables can be repeated in a
relationship chain. The aliases are generated by appending an
incrementing number to the table name.
raw docstring

join-resultsclj

(join-results rel data rel-data)

Takes a relationship map for a many relationship, table data, and the relationship's data, and joins the relationship data into the table data.

Takes a relationship map for a many relationship, table data, and
the relationship's data, and joins the relationship data into the
table data.
raw docstring

path-queryclj

(path-query path conditions)

Takes a path as returned by table-paths, and a collection of conditions, and returns a query to retrieve ids from the base table in the path.

Each condition is a map of:

{:column :table/col :comparator "comparator-sym" :value some-val}

Takes a path as returned by `table-paths`, and a collection of
conditions, and returns a query to retrieve ids from the base table
in the path.

Each condition is a map of:

`{:column :table/col
  :comparator "comparator-sym"
  :value some-val}`
raw docstring

table-idclj

(table-id table)

Returns keyword representing a table id field, eg :table/field.

Returns keyword representing a table id field, eg :table/field.
raw docstring

table-pathsclj

(table-paths table-spec)
(table-paths paths base-path table-spec)

Returns a map, keyed by table name, with all paths to get to that table in given compiled spec.

A path is a vector of [table-with-rel* table-without-rel]

Returns {table-name #{path}}

Returns a map, keyed by table name, with all paths to get to that
table in given compiled spec.

A path is a vector of [table-with-rel* table-without-rel]

Returns  `{table-name #{path}}`
raw docstring

update-table-id-queryclj

(update-table-id-query {:keys [table id updated since] :as update-map})

Takes a map describing update table, and returns a query to retrieve ids to update. Update map has keys:

  • :table Name of the update table
  • :id Name of column with entity ids
  • :updated Name of column with entity update datetimes.
  • :since Datetime to return updates since.
Takes a map describing update table, and returns a query to
retrieve ids to update. Update map has keys:

  * :table     Name of the update table
  * :id        Name of column with entity ids
  * :updated   Name of column with entity update datetimes.
  * :since     Datetime to return updates since.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close