pytd.writer.BulkImportWriter¶
-
class
pytd.writer.
BulkImportWriter
[source]¶ A writer module that loads Python data to Treasure Data by using td-client-python’s bulk importer.
Methods
__init__
(self)Initialize self.
close
(self)from_string
(writer, \*\*kwargs)write_dataframe
(self, dataframe, table, …)Write a given DataFrame to a Treasure Data table.
-
write_dataframe
(self, dataframe, table, if_exists)[source]¶ Write a given DataFrame to a Treasure Data table.
This method internally converts a given pandas.DataFrame into a temporary CSV file, and upload the file to Treasure Data via bulk import API.
- Parameters
- dataframepandas.DataFrame
Data loaded to a target table.
- tablepytd.table.Table
Target table.
- if_exists{‘error’, ‘overwrite’, ‘append’, ‘ignore’}
What happens when a target table already exists.
error: raise an exception.
overwrite: drop it, recreate it, and insert data.
append: insert data. Create if does not exist.
ignore: do nothing.
-