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

Document Custom FileIO #1233

Open
kevinjqliu opened this issue Oct 17, 2024 · 3 comments
Open

Document Custom FileIO #1233

kevinjqliu opened this issue Oct 17, 2024 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@kevinjqliu
Copy link
Contributor

Feature Request / Improvement

Add documentation for custom FileIO, similar to custom catalog

Bring your own FileIO with PY_IO_IMPL

PY_IO_IMPL = "py-io-impl"
def _infer_file_io_from_scheme(path: str, properties: Properties) -> Optional[FileIO]:
parsed_url = urlparse(path)
if parsed_url.scheme:
if file_ios := SCHEMA_TO_FILE_IO.get(parsed_url.scheme):
for file_io_path in file_ios:
if file_io := _import_file_io(file_io_path, properties):
return file_io
else:
warnings.warn(f"No preferred file implementation for scheme: {parsed_url.scheme}")
return None
def load_file_io(properties: Properties = EMPTY_DICT, location: Optional[str] = None) -> FileIO:
# First look for the py-io-impl property to directly load the class
if io_impl := properties.get(PY_IO_IMPL):

@kevinjqliu kevinjqliu added the good first issue Good for newcomers label Oct 17, 2024
@sikehish
Copy link

Feature Request / Improvement

Add documentation for custom FileIO, similar to custom catalog

Bring your own FileIO with PY_IO_IMPL

PY_IO_IMPL = "py-io-impl"
def _infer_file_io_from_scheme(path: str, properties: Properties) -> Optional[FileIO]:
parsed_url = urlparse(path)
if parsed_url.scheme:
if file_ios := SCHEMA_TO_FILE_IO.get(parsed_url.scheme):
for file_io_path in file_ios:
if file_io := _import_file_io(file_io_path, properties):
return file_io
else:
warnings.warn(f"No preferred file implementation for scheme: {parsed_url.scheme}")
return None
def load_file_io(properties: Properties = EMPTY_DICT, location: Optional[str] = None) -> FileIO:
# First look for the py-io-impl property to directly load the class
if io_impl := properties.get(PY_IO_IMPL):

I'd like to take this up! Would this be a seperate section under catalogs? And I believe the heading would be "Bring your own FileIO with PY_IO_IMPL" ?

@kevinjqliu
Copy link
Contributor Author

Assigned to you. I think we can add it under the FileIO section as something like "Custom FileIO Implementations"

@sikehish
Copy link

sikehish commented Oct 18, 2024

Assigned to you. I think we can add it under the FileIO section as something like "Custom FileIO Implementations"

Hi @kevinjqliu. I've added custom fileio implementation section in docs. I'm not very sure if what I've added is what you are looking for. Do let me know if any changes are to be made :)
Here's the PR: #1238

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

No branches or pull requests

2 participants