openclimatefix / pv-site-datamodel

Datamodel for PV sites
MIT License
2 stars 9 forks source link

Add client table #158

Closed Bvr4 closed 1 month ago

Bvr4 commented 2 months ago

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.

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

Checklist:

peterdudfield commented 1 month ago

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 commented 1 month ago

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

peterdudfield commented 1 month ago

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

Thanks @Bvr4

Bvr4 commented 1 month ago

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