Skip to content
This repository was archived by the owner on Dec 5, 2020. It is now read-only.

Commit 585ed96

Browse files
authored
remove SourceType and check; [https://github.com/MarquezProject/marqu… (#104)
* remove SourceType and check; [MarquezProject/marquez-airflow#79] Signed-off-by: SreeV <[email protected]> * no value on source type Signed-off-by: SreeV <[email protected]> * remove reference to SourceType Signed-off-by: SreeV <[email protected]> * no value on source type Signed-off-by: SreeV <[email protected]>
1 parent ec39e84 commit 585ed96

File tree

8 files changed

+25
-38
lines changed

8 files changed

+25
-38
lines changed

marquez_client/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from marquez_client import errors
2020
from marquez_client.constants import (DEFAULT_TIMEOUT_MS)
21-
from marquez_client.models import DatasetType, SourceType, JobType
21+
from marquez_client.models import (DatasetType, JobType)
2222
from marquez_client.utils import Utils
2323
from marquez_client.version import VERSION
2424

@@ -75,12 +75,11 @@ def list_namespaces(self, limit=None, offset=None):
7575
def create_source(self, source_name, source_type, connection_url,
7676
description=None):
7777
Utils.check_name_length(source_name, 'source_name')
78-
Utils.is_instance_of(source_type, SourceType)
7978

8079
Utils.is_valid_connection_url(connection_url)
8180

8281
payload = {
83-
'type': source_type.value,
82+
'type': source_type,
8483
'connectionUrl': connection_url
8584
}
8685

marquez_client/client_wo.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from six.moves.urllib.parse import quote
1717

1818
from marquez_client.version import VERSION
19-
from .models import DatasetType, SourceType, JobType
19+
from .models import (DatasetType, JobType)
2020
from .utils import Utils
2121

2222
_API_PATH = '/api/v1'
@@ -53,12 +53,11 @@ def create_namespace(self, namespace_name, owner_name, description=None):
5353
def create_source(self, source_name, source_type, connection_url,
5454
description=None):
5555
Utils.check_name_length(source_name, 'source_name')
56-
Utils.is_instance_of(source_type, SourceType)
5756

5857
Utils.is_valid_connection_url(connection_url)
5958

6059
payload = {
61-
'type': source_type.value,
60+
'type': source_type,
6261
'connectionUrl': connection_url
6362
}
6463

marquez_client/models.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@
1313
from enum import Enum
1414

1515

16-
class SourceType(Enum):
17-
MYSQL = "MYSQL"
18-
POSTGRESQL = "POSTGRESQL"
19-
REDSHIFT = "REDSHIFT"
20-
SNOWFLAKE = "SNOWFLAKE"
21-
KAFKA = "KAFKA"
22-
REST = "REST"
23-
24-
2516
class DatasetType(Enum):
2617
DB_TABLE = "DB_TABLE"
2718
STREAM = "STREAM"

marquez_client/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from datetime import datetime
1919
from pyrfc3339 import generate
20-
from marquez_client.models import DatasetFieldType, DatasetType
20+
from marquez_client.models import (DatasetFieldType, DatasetType)
2121

2222
log = logging.getLogger(__name__)
2323

tests/test_airflow_dag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import yaml
2121

2222
from marquez_client import Clients
23-
from marquez_client.models import (SourceType, DatasetType, JobType)
23+
from marquez_client.models import (DatasetType, JobType)
2424

2525
from marquez_client.utils import Utils
2626

@@ -58,7 +58,7 @@ def test_create_dag(self):
5858
self.client.create_namespace(NAMESPACE, OWNER)
5959
self.client.create_source(
6060
SOURCE,
61-
SourceType.POSTGRESQL,
61+
'POSTGRESQL',
6262
"jdbc:postgresql://localhost:5432/test?user=fred&ssl=true")
6363
self.client.create_dataset(
6464
NAMESPACE, DATASET, DatasetType.DB_TABLE,

tests/test_marquez_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import yaml
2020

2121
import marquez_client
22-
from marquez_client.models import DatasetType, SourceType, JobType, RunState
22+
from marquez_client.models import (DatasetType, JobType, RunState)
2323
from marquez_client.utils import Utils
2424

2525
_NAMESPACE = "my-namespace"
@@ -175,7 +175,7 @@ def test_get_dataset(self, mock_get):
175175
@mock.patch("marquez_client.client.MarquezClient._put")
176176
def test_create_datasource(self, mock_put):
177177
source_name = "flight_schedules_db"
178-
source_type = SourceType.POSTGRESQL
178+
source_type = 'POSTGRESQL'
179179
source_url = "jdbc:postgresql://localhost:5432/test?" \
180180
"user=fred&password=secret&ssl=true"
181181
description = "PostgreSQL - flight schedules database"
@@ -198,7 +198,7 @@ def test_create_datasource(self, mock_put):
198198

199199
assert response['name'] == source_name
200200
assert response['connectionUrl'] == source_url
201-
assert response['type'] == source_type.value
201+
assert response['type'] == source_type
202202

203203
@mock.patch("marquez_client.client.MarquezClient._put")
204204
def test_create_job(self, mock_put):

tests/test_marquez_write_only_client_file.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@
99
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
12-
import datetime
13-
import unittest
14-
15-
from marquez_client.models import DatasetType, SourceType, JobType, RunState
16-
from marquez_client import Clients
1712

18-
import uuid
1913
import logging
2014
import logging.config
21-
import yaml
2215
import os
16+
import unittest
17+
import uuid
2318

19+
import yaml
20+
21+
from marquez_client import Clients
22+
from marquez_client.models import (DatasetType, JobType)
2423
from marquez_client.utils import Utils
2524

2625
_NAMESPACE = "my-namespace"
@@ -86,7 +85,7 @@ def test_create_dataset(self):
8685

8786
def test_create_datasource(self):
8887
source_name = "flight_schedules_db"
89-
source_type = SourceType.POSTGRESQL
88+
source_type = 'POSTGRESQL'
9089
source_url = "jdbc:postgresql://localhost:5432/test?" \
9190
"user=fred&password=secret&ssl=true"
9291
description = "PostgreSQL - flight schedules database"

tests/test_marquez_write_only_client_http.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
# See the License for the specific language governing permissions and
1111
# limitations under the License.
12-
import datetime
13-
import unittest
14-
15-
from marquez_client.models import DatasetType, SourceType, JobType, RunState
16-
from marquez_client import Clients
1712

18-
import uuid
1913
import logging
2014
import logging.config
21-
import yaml
22-
import mock
2315
import os
16+
import unittest
17+
import uuid
18+
19+
import mock
20+
import yaml
2421

22+
from marquez_client import Clients
23+
from marquez_client.models import (DatasetType, JobType)
2524
from marquez_client.utils import Utils
2625

2726
_NAMESPACE = "my-namespace"
@@ -88,7 +87,7 @@ def test_create_dataset(self, mock_put):
8887
@mock.patch("marquez_client.http_backend.HttpBackend.put")
8988
def test_create_datasource(self, mock_put):
9089
source_name = "flight_schedules_db"
91-
source_type = SourceType.POSTGRESQL
90+
source_type = 'POSTGRESQL'
9291
source_url = "jdbc:postgresql://localhost:5432/test?" \
9392
"user=fred&password=secret&ssl=true"
9493
description = "PostgreSQL - flight schedules database"

0 commit comments

Comments
 (0)