GenieFramework / GenieFramework/SearchLightPostgreSQL.jl

UnretrievedModelException: the DataType data could not be retrieved for id nothing

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
9
Forks
8
PR merge metrics
No merged PRs in 30d

Description

An error occurs when I try to save a record. It works fine using SearchLightSQLite.jl

groups.seed()
[ Info: 2020-11-16 19:48:00 INSERT INTO groups ( "type", "name", "active", "deleted" ) VALUES ( E'B', E'Group one', true, false ) RETURNING id
0.040483 seconds (73 allocations: 4.312 KiB)
ERROR: SearchLight.Exceptions.UnretrievedModelException(Group, nothing, "UnretrievedModelException: the DataType data could not be retrieved for id nothing. \nModel: \nGroup")
Stacktrace:
[1] save!!(::Group; conflict_strategy::Symbol, skip_validation::Bool, skip_callbacks::Array{Symbol,1}) at C:\Users\eolivera\.julia\packages\SearchLight\lFwBS\src\SearchLight.jl:171
[2] #save!#39 at C:\Users\eolivera\.julia\packages\SearchLight\lFwBS\src\SearchLight.jl:157 [inlined]
[3] save! at C:\Users\eolivera\.julia\packages\SearchLight\lFwBS\src\SearchLight.jl:157 [inlined]
[4] |> at .\operators.jl:823 [inlined]
[5] seed() at D:\boxcha\apps\jlbxa\code\WarehouseManagement\app\resources\groups\groups.jl:23
[6] top-level scope at REPL[10]:1

**Groups.jl**

module Groups

import SearchLight: AbstractModel, DbId, save!
import Base: @kwdef

export Group

@kwdef mutable struct Group <: AbstractModel
id::DbId = DbId()
type::String = ""
name::String = ""
active::Bool = true
deleted::Bool = false
end

function seed()
Data = [
("B", "Group one", true, false),
("B", "Group two", true, false)
]

for b in Data
Group(type=b[1], name=b[2], active=b[3], deleted=b[4]) |> save!
end
end

end

**2020111423440271_create_table_groups.jl**

module CreateTableGroups

import SearchLight.Migrations: create_table, column, primary_key, add_index, drop_table

function up()
create_table(:groups) do
[
primary_key()
column(:type, :string)
column(:name, :string)
column(:active, :boolean)
column(:deleted, :boolean)
]
end

add_index(:groups, :name)
end

function down()
drop_table(:groups)
end

end

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with groups.seed() in app/resources/groups/groups.jl, using the migration in 2020111423440271_create_table_groups.jl. Start at save!! in SearchLight.jl line 171 and compare the PostgreSQL path with the reported working SearchLightSQLite.jl path. Done means saving the Group records completes without UnretrievedModelException.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, postgresql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.