Skip to content

Commit 9c9a9ca

Browse files
committed
clean up code
1 parent 78179c5 commit 9c9a9ca

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

data_algebra/data_ops.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class ViewRepresentation(OperatorPlatform, ABC):
4848

4949
column_names: List[str]
5050
column_set: data_algebra.OrderedSet.OrderedSet
51+
column_types: typing.Optional[Dict[str, type]]
5152
sources: List[
5253
"ViewRepresentation"
5354
] # https://www.python.org/dev/peps/pep-0484/#forward-references
@@ -56,6 +57,7 @@ def __init__(
5657
self,
5758
column_names: List[str],
5859
*,
60+
column_types: typing.Optional[Dict[str, type]] = None,
5961
sources: List["ViewRepresentation"] = None,
6062
node_name: str,
6163
):
@@ -80,6 +82,9 @@ def __init__(
8082
for si in sources:
8183
assert isinstance(si, ViewRepresentation)
8284
self.sources = [si for si in sources]
85+
self.column_types = None
86+
if column_types is not None:
87+
self.column_types = column_types.copy()
8388
OperatorPlatform.__init__(
8489
self, node_name=node_name, column_map=collections.OrderedDict(**column_dict)
8590
)
@@ -593,13 +598,13 @@ def __init__(
593598
column_names,
594599
qualifiers=None,
595600
sql_meta=None,
596-
column_types=None,
601+
column_types: typing.Optional[Dict[str, type]] = None,
597602
head=None,
598603
limit_was=None,
599604
nrows=None,
600605
):
601606
ViewRepresentation.__init__(
602-
self, column_names=column_names, node_name="TableDescription"
607+
self, column_names=column_names, node_name="TableDescription", column_types=column_types,
603608
)
604609
if table_name is None:
605610
self.table_name_was_set_by_user = False
@@ -618,9 +623,6 @@ def __init__(
618623
if isinstance(column_names, str):
619624
column_names = [column_names]
620625
self.column_names = [c for c in column_names]
621-
self.column_types = None
622-
if column_types is not None:
623-
self.column_types = column_types.copy()
624626
if qualifiers is None:
625627
qualifiers = {}
626628
assert isinstance(qualifiers, dict)
@@ -1730,6 +1732,8 @@ class ConcatRowsNode(ViewRepresentation):
17301732

17311733
def __init__(self, a, b, *, id_column="table_name", a_name="a", b_name="b"):
17321734
# check set of tables is consistent in both sub-dags
1735+
assert isinstance(a, ViewRepresentation)
1736+
assert isinstance(b, ViewRepresentation)
17331737
a_tables = a.get_tables()
17341738
b_tables = b.get_tables()
17351739
common_keys = set(a_tables.keys()).intersection(b_tables.keys())

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
compose and maintain grammar of data processing steps that in turn can be used to generate
1212
database specific SQL. The package also implements the same transforms for Pandas DataFrames.
1313
14-
Currently the system is primarily adapted and testing for Pandas, Google BigQuery, PostgreSQL, Spark, and
14+
Currently the system is primarily adapted and testing for Pandas, Google BigQuery, PostgreSQL, SQLite, Spark, and
1515
MySQL.
1616
1717
[R](https://www.r-project.org) versions of the system are available as
@@ -37,7 +37,12 @@
3737
'PostgreSQL': ['sqlalchemy', 'psycopg2'],
3838
'MySQL': ['sqlalchemy', 'pymysql'],
3939
'Spark': ['pyspark'],
40-
'all': ['black', 'graphviz', 'BigQuery', 'PostgreSQL', 'MySQL', 'Spark'],
40+
'all': ['black',
41+
'google.cloud', 'pyarrow', 'google-cloud-bigquery',
42+
'sqlalchemy', 'psycopg2',
43+
'pymysql',
44+
'pyspark',
45+
],
4146
},
4247
platforms=['any'],
4348
license='License :: OSI Approved :: BSD 3-clause License',

0 commit comments

Comments
 (0)