Skip to content

Commit

Permalink
Update interface
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroripper committed Dec 6, 2023
1 parent be854e3 commit d0bb131
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/sql_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ const SQLInterface = OpenSQL.SQLInterface
function create_study(
::SQLInterface;
data_path::AbstractString = pwd(),
schema::AbstractString = "schema",
schema_path::AbstractString = joinpath(pwd(), "psrclasses.sql"),
study_collection::String = "PSRStudy",
kwargs...,
)
path_db = joinpath(data_path, "psrclasses.sqlite")
path_schema = joinpath(data_path, "$(schema).sql")
db = OpenSQL.create_empty_db(path_db, path_schema)
db = OpenSQL.create_empty_db(path_db, schema_path)
OpenSQL.create_element!(db, study_collection; kwargs...)
return db
end
Expand Down
16 changes: 8 additions & 8 deletions test/OpenSQL/create_case.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function create_case_1()
db = PSRI.create_study(
PSRI.SQLInterface();
data_path = case_path,
schema = "toy_schema",
schema_path = joinpath(case_path, "toy_schema.sql"),
study_collection = "Configuration",
id = "Toy Case",
value1 = 1.0,
Expand Down Expand Up @@ -169,7 +169,7 @@ function create_case_relations()
db = PSRI.create_study(
PSRI.SQLInterface();
data_path = case_path,
schema = "toy_schema",
schema_path = joinpath(case_path, "toy_schema.sql"),
study_collection = "Configuration",
id = "Toy Case",
value1 = 1.0,
Expand Down Expand Up @@ -243,12 +243,12 @@ function create_case_relations()
"sometype2",
) == ["Cost 2"]

# @test PSRI.get_vector_related(
# db,
# "Plant",
# "Plant 2",
# "sometype"
# ) == ["Cost 1"]
@test PSRI.get_vector_related(
db,
"Plant",
"Plant 2",
"sometype",
) == ["Cost 1"]

PSRI.OpenSQL.close(db)

Expand Down
4 changes: 2 additions & 2 deletions test/OpenSQL/time_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function test_time_series()
db = PSRI.create_study(
PSRI.SQLInterface();
data_path = case_path,
schema = "simple_schema",
schema_path = joinpath(case_path, "simple_schema.sql"),
study_collection = "Study",
id = "Toy Case",
)
Expand Down Expand Up @@ -120,7 +120,7 @@ function test_time_series_2()
db = PSRI.create_study(
PSRI.SQLInterface();
data_path = case_path,
schema = "simple_schema",
schema_path = joinpath(case_path, "simple_schema.sql"),
study_collection = "Study",
id = "Toy Case",
)
Expand Down

0 comments on commit d0bb131

Please sign in to comment.