View Source Plausible.DataMigration.Repo (Plausible v0.0.1)

Ecto.Repo for Clickhouse data migrations, to be started manually, outside of the main application supervision tree.

Summary

Functions

Callback implementation for Ecto.Repo.all/2.

Similar to Ecto.Repo.update_all/3 but uses ALTER TABLE ... UPDATE instead.

Callback implementation for Ecto.Repo.checked_out?/0.

Callback implementation for Ecto.Repo.checkout/2.

Callback implementation for Ecto.Repo.config/0.

Callback implementation for Ecto.Repo.delete/2.

Callback implementation for Ecto.Repo.delete!/2.

A convenience function for SQL-based repositories that forces all connections in the pool to disconnect within the given interval.

Callback implementation for Ecto.Repo.get/3.

Callback implementation for Ecto.Repo.get!/3.

Callback implementation for Ecto.Repo.get_dynamic_repo/0.

Callback implementation for Ecto.Repo.insert/2.

Callback implementation for Ecto.Repo.insert!/2.

Similar to insert_all/2 but with the following differences

Callback implementation for Ecto.Repo.load/2.

Callback implementation for Ecto.Repo.one/2.

Callback implementation for Ecto.Repo.one!/2.

A convenience function for SQL-based repositories that executes the given query.

A convenience function for SQL-based repositories that executes the given query.

Callback implementation for Ecto.Repo.reload/2.

Callback implementation for Ecto.Repo.start_link/1.

Callback implementation for Ecto.Repo.stop/1.

Callback implementation for Ecto.Repo.stream/2.

Similar to to_sql/2 but inlines the parameters into the SQL query.

A convenience function for SQL-based repositories that translates the given query to SQL.

Callback implementation for Ecto.Repo.update/2.

Callback implementation for Ecto.Repo.update!/2.

Functions

Link to this function

aggregate(queryable, aggregate, opts \\ [])

View Source

Callback implementation for Ecto.Repo.aggregate/3.

Link to this function

aggregate(queryable, aggregate, field, opts)

View Source

Callback implementation for Ecto.Repo.aggregate/4.

Link to this function

all(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.all/2.

Link to this function

alter_update_all(queryable, updates, opts \\ [])

View Source

Similar to Ecto.Repo.update_all/3 but uses ALTER TABLE ... UPDATE instead.

For more information and performance implications please see:

Callback implementation for Ecto.Repo.checked_out?/0.

Link to this function

checkout(fun, opts \\ [])

View Source

Callback implementation for Ecto.Repo.checkout/2.

Callback implementation for Ecto.Repo.config/0.

Link to this function

default_options(operation)

View Source

Callback implementation for Ecto.Repo.default_options/1.

Link to this function

delete(struct, opts \\ [])

View Source

Callback implementation for Ecto.Repo.delete/2.

Link to this function

delete!(struct, opts \\ [])

View Source

Callback implementation for Ecto.Repo.delete!/2.

Link to this function

delete_all(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.delete_all/2.

Link to this function

disconnect_all(interval, opts \\ [])

View Source

A convenience function for SQL-based repositories that forces all connections in the pool to disconnect within the given interval.

See Ecto.Adapters.SQL.disconnect_all/3 for more information.

Link to this function

exists?(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.exists?/2.

Link to this function

get(queryable, id, opts \\ [])

View Source

Callback implementation for Ecto.Repo.get/3.

Link to this function

get!(queryable, id, opts \\ [])

View Source

Callback implementation for Ecto.Repo.get!/3.

Link to this function

get_by(queryable, clauses, opts \\ [])

View Source

Callback implementation for Ecto.Repo.get_by/3.

Link to this function

get_by!(queryable, clauses, opts \\ [])

View Source

Callback implementation for Ecto.Repo.get_by!/3.

Callback implementation for Ecto.Repo.get_dynamic_repo/0.

Link to this function

insert(struct, opts \\ [])

View Source

Callback implementation for Ecto.Repo.insert/2.

Link to this function

insert!(struct, opts \\ [])

View Source

Callback implementation for Ecto.Repo.insert!/2.

Link to this function

insert_all(schema_or_source, entries, opts \\ [])

View Source

Callback implementation for Ecto.Repo.insert_all/3.

Link to this function

insert_or_update(changeset, opts \\ [])

View Source

Callback implementation for Ecto.Repo.insert_or_update/2.

Link to this function

insert_or_update!(changeset, opts \\ [])

View Source

Callback implementation for Ecto.Repo.insert_or_update!/2.

Link to this function

insert_stream(source_or_schema, rows, opts \\ [])

View Source

Similar to insert_all/2 but with the following differences:

  • accepts rows as streams or lists
  • sends rows as a chunked request
  • doesn't autogenerate ids or does any other preprocessing

Example:

Repo.query!("create table ecto_ch_demo(a UInt64, b String) engine Null")

defmodule Demo do
  use Ecto.Schema

  @primary_key false
  schema "ecto_ch_demo" do
    field :a, Ch, type: "UInt64"
    field :b, :string
  end
end

rows = Stream.map(1..100_000, fn i -> %{a: i, b: to_string(i)} end)
{100_000, nil} = Repo.insert_stream(Demo, rows)

# schemaless
{100_000, nil} = Repo.insert_stream("ecto_ch_demo", rows, types: [a: Ch.Types.u64(), b: :string])
Link to this function

load(schema_or_types, data)

View Source

Callback implementation for Ecto.Repo.load/2.

Link to this function

one(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.one/2.

Link to this function

one!(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.one!/2.

Link to this function

preload(struct_or_structs_or_nil, preloads, opts \\ [])

View Source

Callback implementation for Ecto.Repo.preload/3.

Link to this function

prepare_query(operation, query, opts)

View Source

Callback implementation for Ecto.Repo.prepare_query/3.

Link to this function

put_dynamic_repo(dynamic)

View Source

Callback implementation for Ecto.Repo.put_dynamic_repo/1.

Link to this function

query(sql, params \\ [], opts \\ [])

View Source

A convenience function for SQL-based repositories that executes the given query.

See Ecto.Adapters.SQL.query/4 for more information.

Link to this function

query!(sql, params \\ [], opts \\ [])

View Source

A convenience function for SQL-based repositories that executes the given query.

See Ecto.Adapters.SQL.query!/4 for more information.

Link to this function

reload(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.reload/2.

Link to this function

reload!(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.reload!/2.

Callback implementation for Ecto.Repo.start_link/1.

Callback implementation for Ecto.Repo.stop/1.

Link to this function

stream(queryable, opts \\ [])

View Source

Callback implementation for Ecto.Repo.stream/2.

Link to this function

to_inline_sql(operation, queryable)

View Source
@spec to_inline_sql(:all | :delete_all | :update_all, Ecto.Queryable.t()) ::
  String.t()

Similar to to_sql/2 but inlines the parameters into the SQL query.

See Ecto.Adapters.ClickHouse.to_inline_sql/2 for more information.

Link to this function

to_sql(operation, queryable)

View Source

A convenience function for SQL-based repositories that translates the given query to SQL.

See Ecto.Adapters.SQL.to_sql/3 for more information.

Link to this function

update(struct, opts \\ [])

View Source

Callback implementation for Ecto.Repo.update/2.

Link to this function

update!(struct, opts \\ [])

View Source

Callback implementation for Ecto.Repo.update!/2.

Link to this function

update_all(queryable, updates, opts \\ [])

View Source

Callback implementation for Ecto.Repo.update_all/3.