Skip to content

Commit

Permalink
chore(server/deps): Upgrade to pydantic ^2.4.2 [TCTC-7241] (#1891)
Browse files Browse the repository at this point in the history
* chore: bump pydantic

Signed-off-by: Luka Peschke <[email protected]>

* chore: run bump-pydantic

Signed-off-by: Luka Peschke <[email protected]>

* fix remaining warnings

Signed-off-by: Luka Peschke <[email protected]>

* fix tests

Signed-off-by: Luka Peschke <[email protected]>

* Stop using deprectaed pydantic methods

Signed-off-by: Luka Peschke <[email protected]>

* fix lockfile

Signed-off-by: Luka Peschke <[email protected]>

* update connectors

Signed-off-by: Luka Peschke <[email protected]>

* refactor: Annotate PipelineOrDomainName to support steps as models

Signed-off-by: Luka Peschke <[email protected]>

* bump pydandic ^2.4.2

Signed-off-by: Luka Peschke <[email protected]>

* refactor: force RelativeDate.date to be a datetime instance

Signed-off-by: Luka Peschke <[email protected]>

* updated connectors branch

Signed-off-by: Luka Peschke <[email protected]>

* fix: Add missing python-dateutil dependency

Signed-off-by: Luka Peschke <[email protected]>

* fix: forbid PipelineStepWithRefs in PipelineWithVariables

Signed-off-by: Luka Peschke <[email protected]>

* feat(server): drop Python 3.10 support

Signed-off-by: Luka Peschke <[email protected]>

* refactor(server/combination): Allow PipelineOrDomainName to be a list[PipelineStep]

Signed-off-by: Luka Peschke <[email protected]>

* refactor(server): replace update_forward_refs() with model_rebuild()

Signed-off-by: Luka Peschke <[email protected]>

* refactor(server): Stronger typing on pipelineOrDomainName

Signed-off-by: Luka Peschke <[email protected]>

* fix(server): temporary fix for the discriminated union bug

Signed-off-by: Luka Peschke <[email protected]>

* fix PipelineWithRefs typing

Signed-off-by: Luka Peschke <[email protected]>

* bump connectors

Signed-off-by: Luka Peschke <[email protected]>

---------

Signed-off-by: Luka Peschke <[email protected]>
  • Loading branch information
lukapeschke authored Dec 15, 2023
1 parent 8e4c240 commit 99346a8
Show file tree
Hide file tree
Showing 48 changed files with 469 additions and 346 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ['3.10', '3.11']
python-version: ['3.11']

defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ COPY playground/dist /weaverbird/playground/dist
RUN yarn build


FROM python:3.10 as server
FROM python:3.11 as server

WORKDIR /weaverbird/server

Expand Down
7 changes: 7 additions & 0 deletions server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog (weaverbird python package)

## Unreleased

## Breaking

- Dropped support for Python 3.10
- Bumped `pydantic` minimum version from 1.x to 2.4.2

## [0.39.0] - 2023-10-16

### Added
Expand Down
23 changes: 11 additions & 12 deletions server/playground.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
from weaverbird.backends.pypika_translator.translate import (
translate_pipeline as pypika_translate_pipeline,
)
from weaverbird.pipeline.pipeline import Pipeline
from weaverbird.pipeline.references import PipelineWithRefs
from weaverbird.pipeline.pipeline import Pipeline, PipelineWithRefs
from weaverbird.pipeline.steps import DomainStep
from weaverbird.pipeline.steps.utils.combination import Reference

Expand Down Expand Up @@ -179,7 +178,7 @@ async def execute_pipeline(pipeline: Pipeline, **kwargs) -> str:
limit=output.pop("limit"),
total_rows=output.pop("total"),
retrieved_rows=len(output["data"]),
).dict()
).model_dump()

return json.dumps(
{
Expand All @@ -206,7 +205,7 @@ async def handle_pandas_backend_request():
return (
jsonify(
{
"step": e.step.dict(),
"step": e.step.model_dump(),
"index": e.index,
"message": e.message,
}
Expand Down Expand Up @@ -346,7 +345,7 @@ def execute_mongo_aggregation_query(collection, query, limit, offset):


async def dummy_reference_resolver(r: Reference) -> list[dict]:
return [DomainStep(domain=r.uid).dict()]
return [DomainStep(domain=r.uid).model_dump()]


@app.route("/mongo", methods=["GET", "POST"])
Expand Down Expand Up @@ -379,7 +378,7 @@ async def handle_mongo_backend_request():

return jsonify(
{
"pagination_info": pagination_info.dict(),
"pagination_info": pagination_info.model_dump(),
"data": results["data"],
"types": results["types"],
"query": mongo_query, # provided for inspection purposes
Expand All @@ -406,7 +405,7 @@ async def handle_mongo_translated_backend_request():

return jsonify(
{
"pagination_info": pagination_info.dict(),
"pagination_info": pagination_info.model_dump(),
"data": results["data"],
"types": results["types"],
"query": req_params["query"], # provided for inspection purposes
Expand Down Expand Up @@ -519,7 +518,7 @@ async def handle_snowflake_backend_request():
limit=limit,
retrieved_rows=len(df_results),
total_rows=total_count,
).dict(),
).model_dump(),
"schema": build_table_schema(df_results, index=False),
"data": json.loads(df_results.to_json(orient="records")),
"query": query, # provided for inspection purposes
Expand Down Expand Up @@ -637,7 +636,7 @@ async def handle_postgres_backend_request():
limit=limit,
retrieved_rows=len(query_results_page),
total_rows=query_total_count,
).dict(),
).model_dump(),
"results": {
"headers": query_results_columns,
"data": query_results_page,
Expand Down Expand Up @@ -699,7 +698,7 @@ async def handle_athena_post_request():
return {
"pagination_info": build_pagination_info(
offset=offset, limit=limit, retrieved_rows=len(result), total_rows=None
).dict(),
).model_dump(),
"results": {
"headers": result.columns.to_list(),
"data": json.loads(result.to_json(orient="records")),
Expand Down Expand Up @@ -767,7 +766,7 @@ async def hangle_bigquery_post_request():
return {
"pagination_info": build_pagination_info(
offset=offset, limit=limit, retrieved_rows=len(result), total_rows=None
).dict(),
).model_dump(),
"results": {
"headers": result.columns.to_list(),
"data": json.loads(result.to_json(orient="records")),
Expand Down Expand Up @@ -834,7 +833,7 @@ async def handle_mysql_post_request():
return {
"pagination_info": build_pagination_info(
offset=offset, limit=limit, retrieved_rows=len(result), total_rows=None
).dict(),
).model_dump(),
"results": {
"headers": result.columns.to_list(),
"data": json.loads(result[offset : offset + limit].to_json(orient="records")),
Expand Down
Loading

0 comments on commit 99346a8

Please sign in to comment.