Skip to content

Conversation

@peterdudfield
Copy link
Contributor

@peterdudfield peterdudfield commented Nov 4, 2025

This fies the sql seeding

  1. use ST_GEOMFROMTWKB twice to insert to database
  2. also add insertions to sources_history table

Ive run this on a database and it runs

This should help with #45

  • Have you followed the Open Climate Fix Contribution Guidelines?
  • Have you referenced the Issue this PR addresses?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added a summary of the changes?
  • Have you written new tests for your changes?.
  • Have you successfully run make lint with your changes locally?
  • Have you successfully run make gen with your changes locally?
  • Have you successfully run make test with your changes locally?

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Benchmark Results

Benchmark results
?   	github.com/openclimatefix/data-platform/cmd	[no test files]
?   	github.com/openclimatefix/data-platform/internal/gen/ocf/dp	[no test files]
?   	github.com/openclimatefix/data-platform/internal/interceptors	[no test files]
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/dummy	0.005s
{"level":"debug","time":"2025-11-04T15:57:48Z","message":"Running migrations"}
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: AMD EPYC 7763 64-Core Processor                
BenchmarkPostgresClient/6144000/GetForecastAsTimeseries-4         	     211	   5346007 ns/op
BenchmarkPostgresClient/6144000/GetForecastAtTimestamp-4          	      40	 106985469 ns/op
BenchmarkPostgresClient/6144000/GetObservationsAsTimeseries-4     	     900	   1288148 ns/op
BenchmarkPostgresClient/6144000/CreateForecast-4                  	     459	   2512725 ns/op
PASS
ok  	github.com/openclimatefix/data-platform/internal/server/postgres	114.030s
?   	github.com/openclimatefix/data-platform/internal/server/postgres/gen	[no test files]
Benchmark vs base branch
goos: linux
goarch: amd64
pkg: github.com/openclimatefix/data-platform/internal/server/postgres
cpu: AMD EPYC 7763 64-Core Processor                
                                                     │ bench-main.txt │          bench-fix-sql.txt           │
                                                     │     sec/op     │    sec/op     vs base                │
PostgresClient/6144000/GetForecastAsTimeseries-4         4.826m ± ∞ ¹   5.346m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/6144000/GetForecastAtTimestamp-4          105.0m ± ∞ ¹   107.0m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/6144000/GetObservationsAsTimeseries-4     1.307m ± ∞ ¹   1.288m ± ∞ ¹       ~ (p=1.000 n=1) ²
PostgresClient/6144000/CreateForecast-4                  2.612m ± ∞ ¹   2.513m ± ∞ ¹       ~ (p=1.000 n=1) ²
geomean                                                  6.449m         6.559m        +1.71%
¹ need >= 6 samples for confidence interval at level 0.95
² need >= 4 samples to detect a difference at alpha level 0.05

@devsjc
Copy link
Contributor

devsjc commented Nov 4, 2025

Why does using it twice fix things?

@peterdudfield
Copy link
Contributor Author

Why does using it twice fix things?

hmm, that im not sure. Perhaps thats not right. Is there an easy way to check the object in the geom column is correct?

@devsjc
Copy link
Contributor

devsjc commented Nov 4, 2025

Only by manually inserting it and seeing what it complains about! I'll put this through since this is just test data anyway, and can worry about it another time!

@peterdudfield peterdudfield merged commit 125a90c into main Nov 4, 2025
3 checks passed
@peterdudfield peterdudfield deleted the fix-sql branch November 4, 2025 16:18
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.

3 participants