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

Dinaminės klasifikatoriaus reikšmės naudojant noop() #1146

Open
2 tasks
Tracked by #45 ...
karina-klinkeviciute opened this issue Feb 10, 2025 · 2 comments · May be fixed by #1180
Open
2 tasks
Tracked by #45 ...

Dinaminės klasifikatoriaus reikšmės naudojant noop() #1146

karina-klinkeviciute opened this issue Feb 10, 2025 · 2 comments · May be fixed by #1180
Assignees
Labels
story User Story

Comments

@karina-klinkeviciute
Copy link
Contributor

karina-klinkeviciute commented Feb 10, 2025

Atvejais, kai enum reikšmės nėra baigtinės, ir kai galima pridėti ir papildomą reikšmę, gali būti naudojama funkcija noop(), ji turėtų būti pridedama prepare stulpelyje.

Ši funkcija aprašyta čia:
ivpk/dsa#45

Pradiniai duomenys

d | r | b | m | property | type    | ref | source       | prepare
dataset1                 |         |     |              |
  | resource1            | sql     |     |              |
  |   |   | City         |         | id  | CITIES       |
  |   |   |   | id       | integer |     | ID           |
  |   |   |   | country  | string  |     | COUNTRY_CODE |
  |   |   |   |          | enum    |     | lt           |
  |   |   |   |          |         |     | ee           |
  |   |   |   |          |         |     | lv           |
  |   |   |   |          |         |     |              | noop()

Vykdoma komanda

spinta check test_dsa.csv

Norimas rezultatas

Ok

Gaunamas rezultatas

Klaida:

Traceback (most recent call last):
  File "spinta/cli/config.py", line 38, in check
    prepare_manifest(context, ensure_config_dir=True, full_load=True)
  File "spinta/cli/helpers/store.py", line 148, in prepare_manifest
    store = load_manifest(
  File "spinta/cli/helpers/store.py", line 137, in load_manifest
    commands.check(context, store.manifest)
  File "spinta/manifests/commands/check.py", line 10, in check
    check(context, obj)
  File "spinta/types/model.py", line 471, in check
    commands.check(context, prop)
  File "spinta/types/model.py", line 479, in check
    commands.check(context, item, prop.dtype, item.prepare)
  File "spinta/dimensions/enum/commands.py", line 23, in check
    raise InvalidValue(dtype, error=(
spinta.exceptions.InvalidValue: Invalid value.
  Context:
    component: spinta.types.datatype.String
    manifest: default
    schema: 4
    dataset: dataset1
    resource: resource1
    model: dataset1/City
    entity: CITIES
    property: country
    attribute: COUNTRY_CODE
    type: string
    resource.backend: dataset1/resource1
    error: Given enum value noop() of <class 'spinta.core.ufuncs.Expr'> type does not match property type, which is 'string'.

Tas pats ir kai reikšmės yra integer, ne string, tik klaida irgi apie integer

Priėmimo kriterijai:

  • kai enum dimensijoje prepare lauke yra įrašyta noop() reikšmė, su šiuo DSA paleidus spinta check komandą, ji nemeta klaidos ir parašo "ok"
  • kai enum dimensijoje prepare lauke yra įrašyta noop() reikšmė, su šiuo DSA paleidus spinta copy komandą, ji perkopijuoja DSA failą tokios pačios struktūros, koks jis yra.

Susiję

@TomasLie TomasLie added the bug Something isn't working label Feb 10, 2025
@sirex sirex added story User Story and removed bug Something isn't working labels Feb 11, 2025
@sirex
Copy link
Collaborator

sirex commented Feb 11, 2025

kai enum dimensijoje prepare lauke yra įrašyta noop() reikšmė, su šiuo DSA paleidus spinta copy komandą, ji perkopijuoja DSA failą tokios pačios struktūros, koks jis yra. (@sirex gali patikslinti, ar dabar šitas būtina, ar kol kas užtenka, kad bent spinta check praeitų?

Turėtu veikti tiek nuskaitymas, tiek išvedimas, tiek check. Todėl, siūlau įgyvendinti šios užduoties apimt6yje ir spinta copy.

@Struchid
Copy link
Contributor

Struchid commented Mar 3, 2025

Papildomi klausimai: #1180 (comment)

Sprendimas pateiktas: #1180 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
story User Story
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants