Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_item issues #307

Closed
2 of 3 tasks
jkiviluo opened this issue Nov 13, 2023 · 1 comment
Closed
2 of 3 tasks

add_item issues #307

jkiviluo opened this issue Nov 13, 2023 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jkiviluo
Copy link
Member

jkiviluo commented Nov 13, 2023

Here's a code that fails on the attached DB (change the path):

import spinedb_api as api
from spinedb_api import DatabaseMapping

url_db_out = "sqlite:///[PATH_TO_DB]/flextool_input_data.sqlite"

parsed_value = api.TimeSeriesFixedResolution(
    api.DateTime("2023-01-01T00:00"),   # start
    "1D",                           # resolution
    [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], # values
    ignore_year=False,
    repeat=False,
)

with DatabaseMapping(url_db_out) as db_flextool:
    value, type_ = api.to_database(parsed_value)
    foo = db_flextool.add_item("parameter_value", check=False,
                                              entity_class_name="node",
                                              parameter_definition_name="inflow",
                                              entity_byname=("east",),
                                              alternative_name="east",
                                              value=value,
                                              type=type_)

The code works if check=True

Other issues to improve:

flextool_input_data.txt

@jkiviluo jkiviluo added the bug Something isn't working label Nov 21, 2023
@jkiviluo jkiviluo added this to the v0.8.0 milestone Nov 21, 2023
@manuelma manuelma self-assigned this Nov 21, 2023
@manuelma
Copy link
Collaborator

manuelma commented Nov 21, 2023

This is supposed to fail - check=False assumes all the reference ids are provided by the client. I think we should undocument the keyword argument and keep it only for internal purposes.

manuelma added a commit that referenced this issue Nov 21, 2023
Re #307

It's for internal use only.
We might even rename it to _check in the future?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants