connect.disconnect.connection.UnsupportedException.DataFrames.DataFrame.find.onereduce.findone.one(x)
one(T::type)Return a multiplicative identity for x: a value such that one(x)*x == x*one(x) == x. Alternatively one(T) can take a type T, in which case one returns a multiplicative identity for any x of type T.
If possible, one(x) returns a value of the same type as x, and one(T) returns a value of type T. However, this may not be the case for types representing dimensionful quantities (e.g. time in days), since the multiplicative identity must be dimensionless. In that case, one(x) should return an identity value of the same precision (and shape, for matrices) as x.
If you want a quantity that is of the same type as x, or of type T, even if x is dimensionful, use oneunit instead.
See also the identity function, and I in [LinearAlgebra](@ref man-linalg) for the identity matrix.
Examples
julia> one(3.7)
1.0
julia> one(Int)
1
julia> import Dates; one(Dates.Day(1))
1randone.all(itr) -> BoolTest whether all elements of a boolean collection are true, returning false as soon as the first false value in itr is encountered (short-circuiting). To short-circuit on true, use any.
If the input contains missing values, return missing if all non-missing values are true (or equivalently, if the input contains no false value), following three-valued logic.
See also: all!, any, count, &, , &&, allunique.
Examples
julia> a = [true,false,false,true]
4-element Vector{Bool}:
1
0
0
1
julia> all(a)
false
julia> all((println(i); v) for (i, v) in enumerate(a))
1
2
false
julia> all([missing, false])
false
julia> all([true, missing])
missingall(p, itr) -> BoolDetermine whether predicate p returns true for all elements of itr, returning false as soon as the first item in itr for which p returns false is encountered (short-circuiting). To short-circuit on true, use any.
If the input contains missing values, return missing if all non-missing values are true (or equivalently, if the input contains no false value), following three-valued logic.
Examples
julia> all(i->(4<=i<=6), [4,5,6])
true
julia> all(i -> (println(i); i < 3), 1:10)
1
2
3
false
julia> all(i -> i > 0, [1, missing])
missing
julia> all(i -> i > 0, [-1, missing])
false
julia> all(i -> i > 0, [1, 2])
trueall(A; dims)Test whether all values along the given dimensions of an array are true.
Examples
julia> A = [true false; true true]
2×2 Matrix{Bool}:
1 0
1 1
julia> all(A, dims=1)
1×2 Matrix{Bool}:
1 0
julia> all(A, dims=2)
2×1 Matrix{Bool}:
0
1all(p, A; dims)Determine whether predicate p returns true for all elements along the given dimensions of an array.
Examples
julia> A = [1 -1; 2 2]
2×2 Matrix{Int64}:
1 -1
2 2
julia> all(i -> i > 0, A, dims=1)
1×2 Matrix{Bool}:
1 0
julia> all(i -> i > 0, A, dims=2)
2×1 Matrix{Bool}:
0
1first.last.save.save!.save!!._save!!.updatewith!.convertmethod.booltypes.autoconvert.updatewith!!.updatewith.createwith.updateby_or_create.update_or_create(m::T; ignore = Symbol[], skip_update = false, filters...)::T where {T<:AbstractModel}Examples
julia>findone_or_create.to_models(m::Type{T}, df::DataFrames.DataFrame)::Vector{T} where {T<:AbstractModel}Return an array of type Model
Examples
julia> DataFrame(Stat, SQLWhereExpression("date >= ? AND date <= ?", startdate, enddate), order=["stats.date"])
8160×9 DataFrame
Row │ stats_id stats_package_uuid stats_package_name stats_status stats_region stats_date stats_request_count stats_year stats_month
│ Int64 String String Int64 String String Int64 Int64 String
──────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 1 00000000-1111-2222-3333-44444444… REPLTreeViews 200 cn-northeast 2021-11-25 1 2021 2021-11
2 │ 17 00701ae9-d1dc-5365-b64a-a3a3ebf5… BioAlignments 200 au 2021-11-25 1 2021 2021-11
3 │ 217 00701ae9-d1dc-5365-b64a-a3a3ebf5… BioAlignments 200 us-west 2021-11-25 1 2021 2021-11
4 │ 314 009559a3-9522-5dbb-924b-0b6ed2b2… XGBoost 200 cn-northeast 2021-11-25 1 2021 2021-11
5 │ 406 009559a3-9522-5dbb-924b-0b6ed2b2… XGBoost 200 eu-central 2021-11-25 5 2021 2021-11
6 │ 461 009559a3-9522-5dbb-924b-0b6ed2b2… XGBoost 200 sa 2021-11-25 1 2021 2021-11
⋮
8160 │ 623498 fff527a3-8410-504e-9ca3-60d5e79b… SimpleANOVA 200 eu-central 2021-11-25 1 2021 2021-11
julia> SearchLight.to_models(Stat, DataFrame(Stat, SQLWhereExpression("date >= ? AND date <= ?", startdate, enddate), order=["stats.date"]))
8160-element Vector{Stat}:
Stat
| KEY | VALUE |
|----------------------|--------------------------------------|
| date::Date | 2021-11-25 |
| id::DbId | 1 |
| month::String | 2021-11 |
| package_name::String | REPLTreeViews |
| package_uuid::String | 00000000-1111-2222-3333-444444444444 |
| region::String | cn-northeast |
| request_count::Int64 | 1 |
| status::Int64 | 200 |
| year::Int64 | 2021 |
⋮
Stat
| KEY | VALUE |
|----------------------|--------------------------------------|
| date::Date | 2021-11-25 |
| id::DbId | 623498 |
| month::String | 2021-11 |
| package_name::String | SimpleANOVA |
| package_uuid::String | fff527a3-8410-504e-9ca3-60d5e79bb1e4 |
| region::String | eu-central |
| request_count::Int64 | 1 |
| status::Int64 | 200 |
| year::Int64 | 2021 |to_model.to_model!!.to_select_part.to_from_part.to_where_part.to_order_part.to_group_part.to_limit_part.to_offset_part.to_having_part.to_join_part.columnsfromjoins(joins::Vector{SQLJoin})::Vector{SQLColumn}
Extracts columns from joins param and adds to be used for the SELECT part
column_data_to_column_name.prepare_column_name.columns_names_by_table.dataframes_by_table.to_find_sql.to_fetch_sql.to_store_sql.to_sqlinput.delete_all.deleteall.delete.query.clone.columns.ispersisted.column_field_name.persistable_fields.settable_fields.table.pk.primary_key_name.strip_table_name.is_fully_qualified.from_fully_qualified.strip_module_name.to_fully_qualified.to_sql_column_names.to_sql_column_name.to_fully_qualified_sql_column_names.fo_fully_qualified_sql_column_name.from_literal_column_name.to_dict.to_string_dict.enclosure.update_query_part.escape_column_name(c::SQLColumn) :: SQLColumn
escape_column_name(s::String)Sanitizes input to be use as column names in SQL queries.
index_name.sql.add_quotes(str::String) :: StringAdds quotes around str and escapes any previously existing quotes.
expand_nullable.NamedTupleNamedTuples are, as their name suggests, named Tuples. That is, they're a tuple-like collection of values, where each entry has a unique name, represented as a Symbol. Like Tuples, NamedTuples are immutable; neither the names nor the values can be modified in place after construction.
Accessing the value associated with a name in a named tuple can be done using field access syntax, e.g. x.a, or using getindex, e.g. x[:a] or x[(:a, :b)]. A tuple of the names can be obtained using keys, and a tuple of the values can be obtained using values.
!!! note
Iteration over NamedTuples produces the values without the names. (See example below.) To iterate over the name-value pairs, use the pairs function.
The @NamedTuple macro can be used for conveniently declaring NamedTuple types.
Examples
julia> x = (a=1, b=2)
(a = 1, b = 2)
julia> x.a
1
julia> x[:a]
1
julia> x[(:a,)]
(a = 1,)
julia> keys(x)
(:a, :b)
julia> values(x)
(1, 2)
julia> collect(x)
2-element Vector{Int64}:
1
2
julia> collect(pairs(x))
2-element Vector{Pair{Symbol, Int64}}:
:a => 1
:b => 2In a similar fashion as to how one can define keyword arguments programmatically, a named tuple can be created by giving a pair name::Symbol => value or splatting an iterator yielding such pairs after a semicolon inside a tuple literal:
julia> (; :a => 1)
(a = 1,)
julia> keys = (:a, :b, :c); values = (1, 2, 3);
julia> (; zip(keys, values)...)
(a = 1, b = 2, c = 3)As in keyword arguments, identifiers and dot expressions imply names:
julia> x = 0
0
julia> t = (; x)
(x = 0,)
julia> (; t.x)
(x = 0,)!!! compat "Julia 1.5" Implicit names from identifiers and dot expressions are available as of Julia 1.5.
!!! compat "Julia 1.7"
Use of getindex methods with multiple Symbols is available as of Julia 1.7.