@@ -88,7 +88,7 @@ def _work_col_group_arg(arg, *, arg_name: str, columns: Iterable[str]):
8888
8989class ViewRepresentation (OperatorPlatform , abc .ABC ):
9090 """Structure to represent the columns of a query or a table.
91- Abstract base class."""
91+ Abstract base class."""
9292
9393 column_names : Tuple [str , ...]
9494 sources : Tuple [
@@ -366,7 +366,12 @@ def to_near_sql_implementation_(
366366 :return: data_algebra.near_sql.NearSQL
367367 """
368368
369- def to_sql (self , db_model = None , * , sql_format_options = None ,) -> str :
369+ def to_sql (
370+ self ,
371+ db_model = None ,
372+ * ,
373+ sql_format_options = None ,
374+ ) -> str :
370375 """
371376 Convert operator dag to SQL.
372377
@@ -376,8 +381,12 @@ def to_sql(self, db_model=None, *, sql_format_options=None,) -> str:
376381 """
377382 if db_model is None :
378383 import data_algebra .SQLite # import late to avoid circular import issue
384+
379385 db_model = data_algebra .SQLite .SQLiteModel ()
380- return db_model .to_sql (ops = self , sql_format_options = sql_format_options ,)
386+ return db_model .to_sql (
387+ ops = self ,
388+ sql_format_options = sql_format_options ,
389+ )
381390
382391 # Pandas realization
383392
@@ -418,14 +427,14 @@ def eval(
418427 check_incoming_data_constraints : bool = False ,
419428 ):
420429 """
421- Evaluate operators with respect to Pandas data frames.
430+ Evaluate operators with respect to Pandas data frames.
422431
423- :param data_map: map from table names to data frames
424- :param data_model: adaptor to data dialect (Pandas for now)
425- :param narrow: logical, if True don't copy unexpected columns
426- :param check_incoming_data_constraints: logical, if True check incoming data meets constraints
427- :return: table result
428- """
432+ :param data_map: map from table names to data frames
433+ :param data_model: adaptor to data dialect (Pandas for now)
434+ :param narrow: logical, if True don't copy unexpected columns
435+ :param check_incoming_data_constraints: logical, if True check incoming data meets constraints
436+ :return: table result
437+ """
429438
430439 if data_map is not None :
431440 assert isinstance (data_map , dict )
@@ -652,13 +661,13 @@ def project(self, ops=None, *, group_by=None) -> "ViewRepresentation":
652661 return self .project_parsed_ (parsed_ops = parsed_ops , group_by = group_by )
653662
654663 def natural_join (
655- self ,
656- b ,
657- * ,
658- on : Optional [Iterable [str ]] = None ,
664+ self ,
665+ b ,
666+ * ,
667+ on : Optional [Iterable [str ]] = None ,
659668 jointype : str ,
660669 check_all_common_keys_in_equi_spec : bool = False ,
661- by : Optional [Iterable [str ]] = None ,
670+ by : Optional [Iterable [str ]] = None ,
662671 check_all_common_keys_in_by : bool = False ,
663672 ) -> "ViewRepresentation" :
664673 """
@@ -686,7 +695,9 @@ def natural_join(
686695 assert isinstance (jointype , str )
687696 assert isinstance (check_all_common_keys_in_equi_spec , bool )
688697 assert isinstance (check_all_common_keys_in_by , bool )
689- check_all_common_keys_in_equi_spec = check_all_common_keys_in_equi_spec or check_all_common_keys_in_by
698+ check_all_common_keys_in_equi_spec = (
699+ check_all_common_keys_in_equi_spec or check_all_common_keys_in_by
700+ )
690701 if self .is_trivial_when_intermediate_ ():
691702 return self .sources [0 ].natural_join (b , on = on , jointype = jointype )
692703 return NaturalJoinNode (
@@ -807,7 +818,7 @@ def select_columns(self, columns) -> "ViewRepresentation":
807818 if isinstance (self , DropColumnsNode ):
808819 return self .sources [0 ].select_columns (columns )
809820 return SelectColumnsNode (source = self , columns = columns )
810-
821+
811822 def map_columns (self , column_remapping ) -> "ViewRepresentation" :
812823 """
813824 Map column names or rename.
@@ -877,12 +888,12 @@ def convert_records(self, record_map) -> "ViewRepresentation":
877888
878889class TableDescription (ViewRepresentation ):
879890 """
880- Describe columns, and qualifiers, of a table.
891+ Describe columns, and qualifiers, of a table.
881892
882- Example:
883- from data_algebra.data_ops import *
884- d = TableDescription(table_name='d', column_names=['x', 'y'])
885- print(d)
893+ Example:
894+ from data_algebra.data_ops import *
895+ d = TableDescription(table_name='d', column_names=['x', 'y'])
896+ print(d)
886897 """
887898
888899 table_name : str
@@ -2419,7 +2430,15 @@ class NaturalJoinNode(ViewRepresentation):
24192430 on : List [str ]
24202431 jointype : str
24212432
2422- def __init__ (self , a , b , * , on : Optional [Iterable [str ]], jointype : str , check_all_common_keys_in_equi_spec : bool = False ):
2433+ def __init__ (
2434+ self ,
2435+ a ,
2436+ b ,
2437+ * ,
2438+ on : Optional [Iterable [str ]],
2439+ jointype : str ,
2440+ check_all_common_keys_in_equi_spec : bool = False ,
2441+ ):
24232442 # check set of tables is consistent in both sub-dags
24242443 a_tables = a .get_tables ()
24252444 b_tables = b .get_tables ()
@@ -2850,7 +2869,9 @@ def __init__(
28502869 self .sql = sql .copy ()
28512870 self .view_name = view_name
28522871 ViewRepresentation .__init__ (
2853- self , column_names = column_names , node_name = "SQLNode" ,
2872+ self ,
2873+ column_names = column_names ,
2874+ node_name = "SQLNode" ,
28542875 )
28552876
28562877 def apply_to (self , a , * , target_table_key = None ):
0 commit comments