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 annotations to the code #1982

Merged
merged 6 commits into from
Dec 6, 2019
Merged

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented Dec 5, 2019

I was working on dbt-spark yesterday, and it was sometime a bit tricky to see what's going on. Having some additional annotations (especially in the adapter part) would really help for newcomers to get around.

Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

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

Hi @Fokko, thanks for your contribution!

Once you've signed the CLA and made a couple tweaks, I'd love to accept this. I've been gradually adding types and appreciate any help on this front!

core/dbt/adapters/cache.py Outdated Show resolved Hide resolved
core/dbt/adapters/sql/impl.py Outdated Show resolved Hide resolved
@dbt-labs dbt-labs deleted a comment from cla-bot bot Dec 5, 2019
@dbt-labs dbt-labs deleted a comment from cla-bot bot Dec 5, 2019
@dbt-labs dbt-labs deleted a comment from cla-bot bot Dec 5, 2019
@dbt-labs dbt-labs deleted a comment from cla-bot bot Dec 5, 2019
@dbt-labs dbt-labs deleted a comment from cla-bot bot Dec 5, 2019
@drewbanin
Copy link
Contributor

Sorry for the CLA spam - should be fixed now 😅. Thanks for signing that @Fokko and really cool PR! @cla-bot check

@cla-bot cla-bot bot added the cla:yes label Dec 5, 2019
@cla-bot
Copy link

cla-bot bot commented Dec 5, 2019

The cla-bot has been summoned, and re-checked this pull request!

@Fokko
Copy link
Contributor Author

Fokko commented Dec 5, 2019

Thanks @drewbanin I've signed the CLA about two hours ago. No worries about the spamming. Let me check the CI

@@ -182,7 +184,7 @@ def drop_schema(self, database, schema):
self.execute_macro(DROP_SCHEMA_MACRO_NAME,
kwargs=kwargs)

def list_relations_without_caching(self, information_schema, schema):
def list_relations_without_caching(self, information_schema, schema) -> List[BaseRelation]:
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is too long and will end up failing pylint, it's too many characters! There are a other more lines like this too (119, 81, 77, 72)

Suggested change
def list_relations_without_caching(self, information_schema, schema) -> List[BaseRelation]:
def list_relations_without_caching(
self, information_schema, schema
) -> List[BaseRelation]:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I've set the line length to 80.

@@ -9,6 +9,7 @@
from dbt.adapters.sql import SQLConnectionManager
from dbt.logger import GLOBAL_LOGGER as logger

from core.dbt.adapters.factory import BaseRelation
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
from core.dbt.adapters.factory import BaseRelation
from dbt.adapters.factory import BaseRelation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What's the difference between core and non-core?

Copy link
Contributor

Choose a reason for hiding this comment

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

dbt makes use of "namespace packages", as defined in PEP 420. The folder core contains one root namespace package in the dbt namespace, which you can install as dbt-core. The various plugin folders also contain root namespace packages in the dbt namespace - in particular they modify dbt.include and dbt.adapters by adding appropriate entries there.

So core is part of the folder structure and doesn't have any semantic meaning on the python side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the explanation, appreciate it.

@beckjake
Copy link
Contributor

beckjake commented Dec 6, 2019

Looks good! I've kicked off the full test suite for this, I don't anticipate any failures. Once it passes we'll get this merged (likely for 0.15.1)

return "text"

@classmethod
def convert_number_type(cls, agate_table, col_idx):
def convert_number_type(cls, agate_table: agate.Table, col_idx: int) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh, I always forget this - our pylint is set to 79 chars, not 80, so this line (just barely) fails it.

Suggested change
def convert_number_type(cls, agate_table: agate.Table, col_idx: int) -> str:
def convert_number_type(
cls, agate_table: agate.Table, col_idx: int
) -> str:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, just pushed a fix.

@beckjake
Copy link
Contributor

beckjake commented Dec 6, 2019

The successful azure tests for this PR are here: https://dev.azure.com/fishtown-analytics/dbt/_build/results?buildId=1142

Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

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

This is great, thanks for the contribution @Fokko - we'll get this merged in for 0.15.1

@beckjake beckjake merged commit 1da96b5 into dbt-labs:dev/0.15.1 Dec 6, 2019
@Fokko Fokko deleted the fd-add-annotations branch December 6, 2019 18:01
@Fokko
Copy link
Contributor Author

Fokko commented Dec 6, 2019

My pleasure @beckjake

Thank you all for developing DBT, I starting to fall in love with it :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants