code: 
  
  
  
  
  
  
  import sys
  from dataclasses import dataclass
  from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union
  
  import pandas as pd
  import pyarrow as pa
  
  import datasets
  import datasets.config
  from datasets.features.features import require_storage_cast
  from datasets.table import table_cast
  
  
  if TYPE_CHECKING:
   import sqlitea
  
   import sqlalchemy
  
  
  lowerCamelCase			:							Any       =datasets.utils.logging.get_logger(__name__)
  
  
  
  
  
  @dataclass
  class     __a						(					datasets.BuilderConfig ):
   _lowerCAmelCase : Union[str, "sqlalchemy.sql.Selectable"] 				=				None
   _lowerCAmelCase : Union[str, "sqlalchemy.engine.Connection", "sqlalchemy.engine.Engine", "sqlite3.Connection"] 				=				None
   _lowerCAmelCase : Optional[Union[str, List[str]]] 				=				None
   _lowerCAmelCase : bool 				=				True
   _lowerCAmelCase : Optional[Union[List, Tuple, Dict]] 				=				None
   _lowerCAmelCase : Optional[Union[List, Dict]] 				=				None
   _lowerCAmelCase : Optional[List[str]] 				=				None
   _lowerCAmelCase : Optional[int] 				=				1_0_0_0_0
   _lowerCAmelCase : Optional[datasets.Features] 				=				None
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     List[Any]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        if self.sql is None:
             raise ValueError("sql must be specified"		)
        if self.con is None:
             raise ValueError("con must be specified"		)
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Tuple							,     SCREAMING_SNAKE_CASE      :     Union[str, Any]							,     SCREAMING_SNAKE_CASE      :     List[str] = None							,     ):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Any        =						config_kwargs.copy()
        # We need to stringify the Selectable object to make its hash deterministic
  
        # The process of stringifying is explained here: http://docs.sqlalchemy.org/en/latest/faq/sqlexpressions.html
        UpperCamelCase__    :     List[Any]        =						config_kwargs["sql"]
        if not isinstance(lowerCamelCase__							,     lowerCamelCase__		):
             if datasets.config.SQLALCHEMY_AVAILABLE and "sqlalchemy" in sys.modules:
                  import sqlalchemy
  
                  if isinstance(lowerCamelCase__							,     sqlalchemy.sql.Selectable		):
                       UpperCamelCase__    :     Union[str, Any]        =						sqlalchemy.create_engine(config_kwargs["con"].split("://"		)[0] + "://"		)
                       UpperCamelCase__    :     Dict        =						str(sql.compile(dialect=engine.dialect		)		)
                       UpperCamelCase__    :     List[str]        =						sql_str
                  else:
                       raise TypeError(
                           F'Supported types for \'sql\' are string and sqlalchemy.sql.Selectable but got {type(lowerCamelCase__		)}: {sql}'		)
             else:
                  raise TypeError(
                      F'Supported types for \'sql\' are string and sqlalchemy.sql.Selectable but got {type(lowerCamelCase__		)}: {sql}'		)
        UpperCamelCase__    :     Optional[Any]        =						config_kwargs["con"]
        if not isinstance(lowerCamelCase__							,     lowerCamelCase__		):
             UpperCamelCase__    :     List[str]        =						id(lowerCamelCase__		)
             logger.info(
                 F'SQL connection \'con\' of type {type(lowerCamelCase__		)} couldn\'t be hashed properly. To enable hashing, specify \'con\' as URI string instead.'		)
  
        return super().create_config_id(lowerCamelCase__							,     custom_features=lowerCamelCase__		)
  
  
  
  
  
  
  
   @property
   def       __lowercase      (	self      :     List[str]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[int]        =						{
            "index_col": self.index_col,
            "columns": self.columns,
            "params": self.params,
            "coerce_float": self.coerce_float,
            "parse_dates": self.parse_dates,
        }
        return pd_read_sql_kwargs
  
  
  
  
  
  
  
  class     __a						(					datasets.ArrowBasedBuilder ):
   _lowerCAmelCase : Optional[Any] 				=				SqlConfig
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Optional[Any]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        return datasets.DatasetInfo(features=self.config.features		)
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     int							,     SCREAMING_SNAKE_CASE      :     List[str]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        return [datasets.SplitGenerator(name=datasets.Split.TRAIN							,     gen_kwargs={}		)]
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Tuple							,     SCREAMING_SNAKE_CASE      :     Tuple		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        if self.config.features is not None:
             UpperCamelCase__    :     Optional[int]        =						self.config.features.arrow_schema
             if all(not require_storage_cast(lowerCamelCase__		) for feature in self.config.features.values()		):
                  # cheaper cast
                  UpperCamelCase__    :     Any        =						pa.Table.from_arrays([pa_table[field.name] for field in schema]							,     schema=lowerCamelCase__		)
             else:
                  # more expensive cast; allows str <-> int/float or str to Audio for example
                  UpperCamelCase__    :     str        =						table_cast(lowerCamelCase__							,     lowerCamelCase__		)
        return pa_table
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Any		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[Any]        =						self.config.chunksize
        UpperCamelCase__    :     Tuple        =						pd.read_sql(
            self.config.sql							,     self.config.con							,     chunksize=lowerCamelCase__							,     **self.config.pd_read_sql_kwargs		)
        UpperCamelCase__    :     str        =						[sql_reader] if chunksize is None else sql_reader
        for chunk_idx, df in enumerate(lowerCamelCase__		):
             UpperCamelCase__    :     int        =						pa.Table.from_pandas(lowerCamelCase__		)
             yield chunk_idx, self._cast_table(lowerCamelCase__		)
style_context: 
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			str:
       if len(__lowerCAmelCase    ) == 0 or not all(len(__lowerCAmelCase    ) == 2 for pair in coordinates    ):
            raise ValueError("The program cannot work out a fitting polynomial."    )
  
       if len({tuple(__lowerCAmelCase    ) for pair in coordinates}    ) != len(__lowerCAmelCase    ):
            raise ValueError("The program cannot work out a fitting polynomial."    )
  
       UpperCamelCase__    :     List[str]        =						{x for x, _ in coordinates}
       if len(__lowerCAmelCase    ) == 1:
            return f'x={coordinates[0][0]}'
  
       if len(__lowerCAmelCase    ) != len(__lowerCAmelCase    ):
            raise ValueError("The program cannot work out a fitting polynomial."    )
  
       UpperCamelCase__    :     Any        =						len(__lowerCAmelCase    )
  
       UpperCamelCase__    :     str        =						0
       UpperCamelCase__    :     list[list[float]]        =						[]
       # put the x and x to the power values in a matrix
       while count_of_line < x:
            UpperCamelCase__    :     int        =						0
            UpperCamelCase__    :     List[Any]        =						coordinates[count_of_line][0]
            UpperCamelCase__    :     list[float]        =						[]
            while count_in_line < x:
                 count_line.append(a ** (x - (count_in_line + 1))    )
                 count_in_line += 1
            matrix.append(__lowerCAmelCase    )
            count_of_line += 1
  
       UpperCamelCase__    :     List[Any]        =						0
       # put the y values into a vector
       UpperCamelCase__    :     list[float]        =						[]
       while count_of_line < x:
            vector.append(coordinates[count_of_line][1]    )
            count_of_line += 1
  
       UpperCamelCase__    :     Tuple        =						0
  
       while count < x:
            UpperCamelCase__    :     Dict        =						0
            while zahlen < x:
                 if count == zahlen:
                      zahlen += 1
                 if zahlen == x:
                      break
                 UpperCamelCase__    :     Optional[Any]        =						matrix[zahlen][count] / matrix[count][count]
                 for counting_columns, item in enumerate(matrix[count]    ):
                      # manipulating all the values in the matrix
                      matrix[zahlen][counting_columns] -= item * bruch
                 # manipulating the values in the vector
                 vector[zahlen] -= vector[count] * bruch
                 zahlen += 1
            count += 1
  
       UpperCamelCase__    :     Tuple        =						0
       # make solutions
       UpperCamelCase__    :     list[str]        =						[]
       while count < x:
            solution.append(str(vector[count] / matrix[count][count]    )    )
            count += 1
  
       UpperCamelCase__    :     int        =						0
       UpperCamelCase__    :     List[str]        =						"f(x)="
  
       while count < x:
            UpperCamelCase__    :     list[str]        =						solution[count].split("E"    )
            if len(__lowerCAmelCase    ) > 1:
                 UpperCamelCase__    :     Union[str, Any]        =						f'{remove_e[0]}*10^{remove_e[1]}'
            solved += f'x^{x - (count + 1)}*{solution[count]}'
            if count + 1 != x:
                 solved += "+"
            count += 1
  
       return solved
  
  
  if __name__ == "__main__":
   print(points_to_polynomial([]))
   print(points_to_polynomial([[]]))
   print(points_to_polynomial([[1, 0], [2, 0], [3, 0]]))
   print(points_to_polynomial([[1, 1], [2, 1], [3, 1]]))
   print(points_to_polynomial([[1, 3], [2, 3], [3, 3]]))
   print(points_to_polynomial([[1, 1], [2, 2], [3, 3]]))
   print(points_to_polynomial([[1, 1], [2, 4], [3, 9]]))
   print(points_to_polynomial([[1, 3], [2, 6], [3, 11]]))
   print(points_to_polynomial([[1, -3], [2, -6], [3, -11]]))
   print(points_to_polynomial([[1, 5], [2, 2], [3, 9]]))