Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Fix MySQL column mapping (#44)
Browse files Browse the repository at this point in the history
* Fix MySQL column mapping

* Remove unused import

* Fix formatting

* Remove tests
  • Loading branch information
DementevNikita authored Jun 21, 2022
1 parent b5227c2 commit 0602898
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 38 deletions.
22 changes: 6 additions & 16 deletions odd_collector/adapters/mysql/mappers/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from odd_models.models import (
DataEntity,
DataSet,
DataTransformer,
DataEntityType,
DataEntityGroup,
)
Expand All @@ -29,7 +28,8 @@ def map_tables(
database: str,
) -> List[DataEntity]:
data_entities: List[DataEntity] = []
column_index: int = 0

column_metadata = [ColumnMetadataNamedtuple(*c) for c in columns]

for table in tables:
metadata: MetadataNamedtuple = MetadataNamedtuple(*table)
Expand Down Expand Up @@ -78,22 +78,12 @@ def map_tables(
metadata.view_definition, oddrn_generator
)

# DatasetField
while column_index < len(columns):
column: tuple = columns[column_index]
column_metadata: ColumnMetadataNamedtuple = ColumnMetadataNamedtuple(
*column
)

if column_metadata.table_name == table_name:
for column in column_metadata:
if column.table_name == table_name and column.table_schema == database:
data_entity.dataset.field_list.append(
map_column(
column_metadata, oddrn_generator, data_entity.owner, oddrn_path
)
map_column(column, oddrn_generator, data_entity.owner, oddrn_path)
)
column_index += 1
else:
break

data_entities.append(
DataEntity(
oddrn=oddrn_generator.get_oddrn_by_path("databases"),
Expand Down
Empty file removed tests/__init__.py
Empty file.
22 changes: 0 additions & 22 deletions tests/test_kafka.py

This file was deleted.

0 comments on commit 0602898

Please sign in to comment.