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

Removed extra conditions in _auto_identify_connection_string method #2038

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ChandanChainani
Copy link
Contributor

Description

Moved uri string validation case on the start and remove additional conditions as it seem unnecessary

Related Issues

ISSUE: NA

Checklist

  • Is this code covered by new or existing unit tests or integration tests?
  • Did you run make unit-testing and make integration-testing successfully?
  • Do new classes, functions, methods and parameters all have docstrings?
  • Were existing docstrings updated, if necessary?
  • Was external documentation updated, if necessary?


elif item.startswith('mongodb://'):
kwargs['data_backend'] = item
kwargs['data_backend'] = item
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @ChandanChainani thanks for the PR. Are you sure that these can be dropped like this? Do you get passing tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @blythed, Yes, except for llm and doc_string related test all the other tests are validated

Command

pytest ./test/unittest/ -svv --ignore=test/unittest/ext/test_llama_cpp.py --ignore=test/unittest/ext/llm --ignore=test/unittest/ext/transformers/test_llm.py --ignore=test/unittest/ext/transformers/test_llm_training.py --ignore=test/unittest/ext/transformers/test_transformers.py

Output

=============================================== short test summary info ===============================================
=============================================== short test summary info ===============================================
FAILED test/unittest/cli/test_cli.py::test_cli_info - subprocess.CalledProcessError: Command '('python', '-m', 'superduperdb', 'info')' returned non-zero exit status 1.
ERROR test/unittest/backends/ibis/test_query.py::test_renamings - NotADirectoryError: [WinError 267] The directory name is invalid: 'C:\\Users\\...\\AppData\\Local\\Temp\\tmpi9bnoy_0\\test.ddb'
=========================== 1 failed, 194 passed, 1112 skipped, 1 error in 85.44s (0:01:25) ===========================```

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blythed

I have update the code and there is one additional condition that I think can be added which is to make sure the user only supply supported db/file uri format please suggest (for supported db/file format we can maintain constants)


elif item.startswith('mongodb+srv://') and 'mongodb.net' in item:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @ChandanChainani , we need to check this pattern, because re_match(r'^[a-zA-Z0-9]+://', 'mongodb+srv://') is None == Ture, then will raise an error.


if item.startswith('mongomock://'):
kwargs['data_backend'] = item
if re_match(r'^[a-zA-Z0-9]+://', item) is None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use re.match

@jieguangzhou
Copy link
Collaborator

@ChandanChainani Thanks for your PR, Please update the CHANGELOG file, and update the review comments, we will merge the PR after the CI passes, thanks

@blythed blythed force-pushed the main branch 2 times, most recently from b8748a3 to 04010cf Compare May 22, 2024 08:34
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.

None yet

3 participants