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 client table #158

Merged
merged 12 commits into from
Oct 13, 2024
Merged

Add client table #158

merged 12 commits into from
Oct 13, 2024

Conversation

Bvr4
Copy link
Contributor

@Bvr4 Bvr4 commented Sep 20, 2024

Pull Request

Description

This PR refers to the issue #148 Client table.

Added client table with client_name. Mapped the table with sites.
Made alembic migration.
Added read functions : get_sites_by_blient_name and get_client_by_name (with the option of creating the client if it doesn't exist.
Added write functions : create_client, edit_client, assign_site_to_client.

Fixes #

How Has This Been Tested?

I created the tests associated with each function, via pytest.
For that, I made small modifications to conftest.py, like the creation of a client fixture.

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

Bvr4 and others added 11 commits September 13, 2024 11:12
Add clientSQL in splmodels, with client_name
Mapped relationships between Client and Site
)

add function, tests, and edited sites fixture in conftest in order to have client informations in tests samples
added create_client and edit_client functions, and related tests.
edited PVSiteEditMetadata pydantic model, so edit_site function can update the client_uuid.
edited create_site function, so it can set the client_uuid.
Moved the client functions from user_and_site.py to client.py
Added get_client_by_name function, and related tests. This function can create a new client if it doesn't exist.
@peterdudfield
Copy link
Contributor

Hi @Bvr4

Thanks so much for this.

You ok to adjust the alembic migration, its just becasue another one has sneaked in this before this. You can either update the hash in the migrations, or just re make it.

I think other than, that, its ready to go

@Bvr4
Copy link
Contributor Author

Bvr4 commented Oct 3, 2024

OK, I'll take a look at it next week.

@peterdudfield
Copy link
Contributor

OK, I'll take a look at it next week.

Thanks @Bvr4

@Bvr4
Copy link
Contributor Author

Bvr4 commented Oct 9, 2024

I edited the revises and down_revision hashes in the alembic migration. I guess it will do the trick.

@peterdudfield peterdudfield reopened this Oct 13, 2024
@peterdudfield peterdudfield merged commit 720720b into openclimatefix:main Oct 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants