def create_table_from_csv(<EOL>self,<EOL>csv_source,<EOL>table_name="<STR_LIT>",<EOL>attr_names=(),<EOL>delimiter="<STR_LIT:U+002C>",<EOL>quotechar='<STR_LIT:">',<EOL>encoding="<STR_LIT:utf-8>",<EOL>primary_key=None,<EOL>add_primary_key_column=False,<EOL>index_attrs=None,<EOL>):
import pytablereader as ptr<EOL>loader = ptr.CsvTableFileLoader(csv_source)<EOL>if typepy.is_not_null_string(table_name):<EOL><INDENT>loader.table_name = table_name<EOL><DEDENT>loader.headers = attr_names<EOL>loader.delimiter = delimiter<EOL>loader.quotechar = quotechar<EOL>loader.encoding = encoding<EOL>try:<EOL><INDENT>for table_data in loader.load():<EOL><INDENT>self.__create_table_from_tabledata(<EOL>table_data, primary_key, add_primary_key_column, index_attrs<EOL>)<EOL><DEDENT>return<EOL><DEDENT>except (ptr.InvalidFilePathError, IOError):<EOL><INDENT>pass<EOL><DEDENT>loader = ptr.CsvTableTextLoader(csv_source)<EOL>if typepy.is_not_null_string(table_name):<EOL><INDENT>loader.table_name = table_name<EOL><DEDENT>loader.headers = attr_names<EOL>loader.delimiter = delimiter<EOL>loader.quotechar = quotechar<EOL>loader.encoding = encoding<EOL>for table_data in loader.load():<EOL><INDENT>self.__create_table_from_tabledata(<EOL>table_data, primary_key, add_primary_key_column, index_attrs<EOL>)<EOL><DEDENT>
Create a table from a CSV file/text.

:param str csv_source: Path to the CSV file or CSV text.
:param str table_name:
    Table name to create.
    Using CSV file basename as the table name if the value is empty.
:param list attr_names:
    Attribute names of the table.
    Use the first line of the CSV file as attributes if ``attr_names`` is empty.
:param str delimiter:
    A one-character string used to separate fields.
:param str quotechar:
    A one-character string used to quote fields containing special
    characters, such as the ``delimiter`` or ``quotechar``,
    or which contain new-line characters.
:param str encoding: CSV file encoding.
:param str primary_key: |primary_key|
:param tuple index_attrs: |index_attrs|
:raises ValueError: If the CSV data is invalid.

:Dependency Packages:
    - `pytablereader <https://github.com/thombashi/pytablereader>`__

:Example:
    :ref:`example-create-table-from-csv`

.. seealso::
    :py:meth:`.create_table_from_data_matrix`
    :py:func:`csv.reader`
    :py:meth:`.pytablereader.CsvTableFileLoader.load`
    :py:meth:`.pytablereader.CsvTableTextLoader.load`