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

Basic local FS functionality #3693

Merged
merged 5 commits into from
Aug 13, 2021

Conversation

iknox-fa
Copy link
Contributor

@iknox-fa iknox-fa commented Aug 4, 2021

PR for first segment of local FS storage adapter.
Contains:

  • adapter logic
  • storage client (loads adapter)
  • typing work for hinting and mypy
  • integration into codebase in all places where the old system client was used.

This breaks a few unit tests and 1 integration test. The unit test failures are utilizing MagicMocks which don't seem to play nice as file paths for some reason. The integration test failure is in partial parsing testing, needs further investigation

path: Path = Path(path)

# handle overwrite errors for files and directories
if path.exists() and (overwrite is False or path.is_dir() is True):
Copy link
Contributor

Choose a reason for hiding this comment

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

If directory already exists, that essentially is a no-op. Would you consider that not successful? I honestly don't know how that effects things in the code, but it just seemed odd to me

Copy link
Contributor Author

@iknox-fa iknox-fa Aug 5, 2021

Choose a reason for hiding this comment

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

Yeah it's a kind of funny interaction to model out. I do consider it a "fail" (hence it returns false), but one that may be expected under certain circumstances. For example, you can do things like to populate a directory with files (say our snowplow event cookie)

if SA.write('path/that/might/be/here', None):
    SA.write('path/that/might/be/here/important_cookie_file.json`, TEMPLATE_STRING)

path: Path = Path(path)

# ensure resource to be deleted exists
if not path.exists():
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here, if it doesn't already exist, would you call it not successful?

Copy link
Contributor

@leahwicz leahwicz left a comment

Choose a reason for hiding this comment

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

Other than those few comments, LGTM!

@@ -0,0 +1 @@
Move the warehouse adapters to a subfolder of adapters (adapters/warehouse).
Copy link
Contributor

@jtcohen6 jtcohen6 Aug 5, 2021

Choose a reason for hiding this comment

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

These are in plugins/ right now (and three of them are soon to leave this repo). Let's think about whether local_filesystem makes more sense under plugins/ or as part of core/.

Also... we'll need to come up with a new word for this, since none of warehouse, database, query engine, etc is quite perfect. To date, I've just been using "adapter" as a nice catch-all, but obviously we've got adapters for more things now :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JerCo That makes sense. I'll do some folder juggling and see where we land. As far as naming goes.. I've been leaning towards "warehouse adapters" and "storage adapters", but I don't hold that opinion too strongly.

Copy link
Contributor

Choose a reason for hiding this comment

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

lmk if you want to chat plugins! I think I have a good sense how that could look

Copy link
Contributor

@kwigley kwigley left a comment

Choose a reason for hiding this comment

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

looks good! just left some questions for you

Comment on lines +31 to +33
@staticmethod
def find() -> None:
pass
Copy link
Contributor

Choose a reason for hiding this comment

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

What is find responsible for? Is the same thing accomplished by info?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's a reminder to me that I need to incorporate the find_matching method from the dbt.client.system

@@ -0,0 +1 @@
Move the warehouse adapters to a subfolder of adapters (adapters/warehouse).
Copy link
Contributor

Choose a reason for hiding this comment

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

lmk if you want to chat plugins! I think I have a good sense how that could look

@nathaniel-may nathaniel-may removed their request for review August 12, 2021 17:01
@nathaniel-may
Copy link
Contributor

pulling myself off because it looks like you have plenty of reviews. Let me know if you need me for any part of this though.

@iknox-fa iknox-fa merged commit 8507a5b into feature/local-fs-storage-adapter Aug 13, 2021
@iknox-fa iknox-fa deleted the local-fs-sa-skateboard branch August 13, 2021 22:06
@iknox-fa iknox-fa restored the local-fs-sa-skateboard branch August 13, 2021 22:07
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.

7 participants