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

🎉 Source Looker: enable supporting of customer-hosted (self-hosted) instances #3587

Merged
merged 14 commits into from
Jun 22, 2021

Conversation

Janardhanpoola
Copy link
Contributor

What

Adding support for self/customer hosted looker instance.(#3393)

How

Describe the solution

Pre-merge Checklist

  • Run integration tests
  • Publish Docker images

Recommended reading order

  1. test.java
  2. component.ts
  3. the rest

"pattern": ["^[a-zA-Z0-9._-]*\\.looker\\.com$"],
"examples": ["domainname.looker.com"],
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com"
"pattern": ["(^[a-zA-Z0-9._-]*\\.looker\\.com$)|(^looker\\.[a-zA-Z0-9._-]*\\.com$)|(^[0-9]+(?:\\.[0-9]+){3}(:[0-9]+)?$)"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should the second pattern have looker in the name? It should just be any url right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see looker.[yourdomain].com in the documentation.
https://docs.looker.com/setup-and-management/on-prem-install/installation#create_a_dns_record

If that's not the case , ill change to support any url

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing that's more of a suggestion than a requirement. We can probably give that pattern in the examples array but not strictly require it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also we shouldn't require .com

Copy link
Contributor Author

Choose a reason for hiding this comment

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

could you give me some examples so that i get clarity on how to write regex pattern

@vitaliizazmic vitaliizazmic linked an issue May 28, 2021 that may be closed by this pull request
@vitaliizazmic vitaliizazmic requested review from vitaliizazmic and removed request for masonwheeler May 28, 2021 15:32
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com"
"pattern": [
"(^[a-zA-Z0-9._-]*\\.looker\\.com$)|(^[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*$)|(^[0-9]+(?:\\.[0-9]+){3}(:[0-9]+)?$)"
],
Copy link
Contributor

Choose a reason for hiding this comment

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

The pattern needs to be checked. For example, the second group requires entry string dived at least by two dots. I think this is wrong. The third group has no segment length limitation.

"examples": ["domainname.looker.com"],
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com"
"pattern": [
"(^[a-zA-Z0-9._-]*\\.looker\\.com$)|(^(?:[a-zA-Z0-9._-]*)?[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*$)|(^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(?::\\d{1,5})?$)"
Copy link
Contributor

@sherifnada sherifnada Jun 1, 2021

Choose a reason for hiding this comment

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

can you create unit tests to verify this works? I'm not sure the second regex works as intended. I tested it on https://regex101.com/ with looker.airbyte.com and it didn't work.

If it's too hard to pin down the regex then we can remove the pattern entirely and rely on the check operation to verify the domain is correct.

Copy link
Contributor Author

@Janardhanpoola Janardhanpoola Jun 2, 2021

Choose a reason for hiding this comment

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

(^(?:[a-zA-Z0-9._-]*)?[a-zA-Z0-9._-]*\\.[a-zA-Z0-9._-]*$)-->pattern in spec.json

(^(?:[a-zA-Z0-9._-]*)?[a-zA-Z0-9._-]*\.[a-zA-Z0-9._-]*$)--->pattern in python(used for testing in regexp101)

Did you try changing \\. to \. and then test it on regexp101. since '.' have special meaning ..we use \ as an escape character in python. But regexp pattern in spec.json file expects us to use \\ as an escape character. Same applies for matching the digits \d in third pattern. Please find the snap below that matches several domains and let me know if any changes required:

image

Copy link
Contributor

Choose a reason for hiding this comment

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

@Janardhanpoola hm, what about my.shiny.website.com:1234?

Copy link
Contributor

Choose a reason for hiding this comment

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

agree, please add a unit test for this.

import re
import unittest

def valid_URL(test_str):
Copy link
Contributor

@keu keu Jun 3, 2021

Choose a reason for hiding this comment

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

do you know how we can avoid duplication and use regex from spec file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think may be we can access spec dict and can refer pattern using spec["properties"]["domain"]["pattern"]. I'm quite unsure of the imports here. can you point me an example here

Copy link
Contributor

Choose a reason for hiding this comment

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

try to search @pytest.fixture in our codebase, there will be plenty of examples

Copy link
Contributor Author

@Janardhanpoola Janardhanpoola Jun 3, 2021

Choose a reason for hiding this comment

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

Added @pytest.fixture as suggested




class TestURLPattern(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

also we are trying to follow pytest-style tests, please check this for example how you can do it

Copy link
Contributor

@keu keu left a comment

Choose a reason for hiding this comment

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

see comments

@@ -0,0 +1,44 @@
import re
Copy link
Contributor

Choose a reason for hiding this comment

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

Naming shall conform to PEP8 Naming Conventions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed filename and tests as per pep8 standards

return result.group(0)

@pytest.fixture
def url():
Copy link
Contributor

@keu keu Jun 3, 2021

Choose a reason for hiding this comment

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

this is not what I meant, there is an example of parameterized tests on the page that I sent you.
You don't need to repeat the same test again and again

import re
import pytest

def valid_url(test_str):
Copy link
Contributor

Choose a reason for hiding this comment

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

also, this still does not prevents us from duplication. What will happen with this test if we decide to change the spec?

Copy link
Contributor

@keu keu Jun 3, 2021

Choose a reason for hiding this comment

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

you can check


for examples

@keu keu changed the title Source looker Source Looker: support self-hosted domains Jun 7, 2021
@vitaliizazmic vitaliizazmic requested a review from keu June 14, 2021 13:32
"looker.clientname.com",
"123.123.124.123:8000"
],
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com,looker.[clientname].com,ip address"
Copy link
Contributor

@yevhenii-ldv yevhenii-ldv Jun 15, 2021

Choose a reason for hiding this comment

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

Suggested change
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com,looker.[clientname].com,ip address"
"description": "Domain for your Looker account, e.g. airbyte.cloud.looker.com, looker.[clientname].com, IP address"

@vitaliizazmic
Copy link
Contributor

vitaliizazmic commented Jun 17, 2021

/test connector=source-looker

🕑 source-looker https://github.com/airbytehq/airbyte/actions/runs/945518267
✅ source-looker https://github.com/airbytehq/airbyte/actions/runs/945518267

@github-actions github-actions bot added the area/connectors Connector related issues label Jun 17, 2021
@sherifnada
Copy link
Contributor

@vitaliizazmic make sure to format the PR name correctly

@vitaliizazmic vitaliizazmic changed the title Source Looker: support self-hosted domains 🎉 Source Looker: enable supporting of customer-hosted (self-hosted) instances Jun 22, 2021
@vitaliizazmic
Copy link
Contributor

vitaliizazmic commented Jun 22, 2021

/publish connector=connectors/source-looker

🕑 connectors/source-looker https://github.com/airbytehq/airbyte/actions/runs/960496864
✅ connectors/source-looker https://github.com/airbytehq/airbyte/actions/runs/960496864

@vitaliizazmic vitaliizazmic merged commit 3d44999 into master Jun 22, 2021
@vitaliizazmic vitaliizazmic deleted the source-looker branch June 22, 2021 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a feature to support Looker self-hosted instance domain
5 participants