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

Feature: New driver - pg #78

Merged
merged 8 commits into from
Sep 24, 2022
Merged

Feature: New driver - pg #78

merged 8 commits into from
Sep 24, 2022

Conversation

oscar60310
Copy link
Contributor

@oscar60310 oscar60310 commented Sep 21, 2022

Description

  • Implement data source for Postgres.
  • I changed the default data source to "mock" because it was "pg".
  • Destroy the source stream when Koa destroyed the downstream, it's important for pg driver because it needs to release the connection to the pool.

Issue ticket number

closes #56

Additional Context

  • I used a real pg server in docker to run the test, so our unit tests need Docker env to run.
  • I changed the CI environment from docker to VM in order to run docker services

@oscar60310 oscar60310 changed the base branch from develop to feature/authorization September 21, 2022 02:18
@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2022

Codecov Report

Base: 92.52% // Head: 92.58% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (b514d26) compared to base (46c0080).
Patch coverage: 95.23% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #78      +/-   ##
===========================================
+ Coverage    92.52%   92.58%   +0.05%     
===========================================
  Files          245      248       +3     
  Lines         3533     3613      +80     
  Branches       446      453       +7     
===========================================
+ Hits          3269     3345      +76     
- Misses         179      183       +4     
  Partials        85       85              
Flag Coverage Δ
build 94.54% <ø> (ø)
cli 88.96% <ø> (ø)
core 93.26% <100.00%> (ø)
extension-dbt 97.43% <ø> (ø)
extension-debug-tools 98.11% <ø> (ø)
extension-driver-duckdb 100.00% <ø> (ø)
extension-driver-pg 94.87% <94.87%> (?)
integration-testing 96.15% <ø> (ø)
serve 90.21% <100.00%> (+0.02%) ⬆️
test-utility ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ckages/extension-driver-pg/src/lib/pgDataSource.ts 93.33% <93.33%> (ø)
packages/core/src/lib/data-source/index.ts 100.00% <100.00%> (ø)
packages/core/src/lib/data-source/mock.ts 42.85% <100.00%> (ø)
packages/extension-driver-pg/src/index.ts 100.00% <100.00%> (ø)
packages/extension-driver-pg/src/lib/typeMapper.ts 100.00% <100.00%> (ø)
...s/serve/src/models/extensions/responseFormatter.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@oscar60310 oscar60310 force-pushed the feature/driver-pg branch 2 times, most recently from 115504e to 9848eaf Compare September 21, 2022 10:28
@oscar60310 oscar60310 changed the title [WIP] Feature: New driver - pg Feature: New driver - pg Sep 21, 2022
@oscar60310 oscar60310 requested a review from kokokuo September 21, 2022 10:39
@oscar60310 oscar60310 marked this pull request as ready for review September 21, 2022 10:40
@oscar60310 oscar60310 changed the title Feature: New driver - pg [WIP] Feature: New driver - pg Sep 21, 2022
@oscar60310 oscar60310 removed the request for review from kokokuo September 21, 2022 15:39
@oscar60310 oscar60310 marked this pull request as draft September 21, 2022 15:39
@oscar60310 oscar60310 changed the title [WIP] Feature: New driver - pg Feature: New driver - pg Sep 22, 2022
@oscar60310 oscar60310 requested a review from kokokuo September 22, 2022 04:06
@oscar60310 oscar60310 marked this pull request as ready for review September 22, 2022 04:06
@oscar60310 oscar60310 force-pushed the feature/authorization branch from 34441c8 to b41d3fc Compare September 22, 2022 04:13
Base automatically changed from feature/authorization to develop September 22, 2022 14:29
@oscar60310
Copy link
Contributor Author

@kokokuo I've solved the conflicts, and this PR is ready for review.

Copy link
Contributor

@kokokuo kokokuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 👍

@kokokuo kokokuo merged commit dcd4495 into develop Sep 24, 2022
@kokokuo kokokuo deleted the feature/driver-pg branch September 24, 2022 03:39
@kokokuo
Copy link
Contributor

kokokuo commented Jul 5, 2023

@oscar60310, just have a question after I also develop another data source, why do we need to do the typeMapper and convert the postgres original type and snowflake to typescript matched type?

@oscar60310
Copy link
Contributor Author

@oscar60310, just have a question after I also develop another data source, why do we need to do the typeMapper and convert the postgres original type and snowflake to typescript matched type?

For generating the response schema in the specification.
https://github.com/Canner/vulcan-sql/blob/develop/packages/build/src/lib/schema-parser/middleware/responseSampler.ts#L48-L64

PG (or other data sources) has lots of data types, e.g. int2, int4, etc., but our API spec only has some basic types: string, number, etc. So the connectors have to tell Vulcan core how should we map the corresponding types, that is, make the types simpler to understand.

@kokokuo
Copy link
Contributor

kokokuo commented Jul 5, 2023

@oscar60310, just have a question after I also develop another data source, why do we need to do the typeMapper and convert the postgres original type and snowflake to typescript matched type?

For generating the response schema in the specification.

https://github.com/Canner/vulcan-sql/blob/develop/packages/build/src/lib/schema-parser/middleware/responseSampler.ts#L48-L64

PG (or other data sources) has lots of data types, e.g. int2, int4, etc., but our API spec only has some basic types: string, number, etc. So the connectors have to tell Vulcan core how should we map the corresponding types, that is, make the types simpler to understand.

Thanks so much!!!! I'm working ClickHouse now, it really helpful for me to handle it 😀

Also cc @JSYOU, @onlyjackfrost, @andreashimin, @fredalai, and @wwwy3y3 to know the the reason.

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.

New driver: Postgres - statement
3 participants