civisanalytics / civis-python

Civis API Python Client
BSD 3-Clause "New" or "Revised" License
34 stars 26 forks source link

Add column overrides to file imports #344

Closed alexm1309 closed 3 years ago

alexm1309 commented 4 years ago

With the endpoint POST to /imports/files/csv, a user can specify a tableColumns array where they can set destination column names and data types. It'd be helpful if users could leverage that endpoint in our various I/O functions that serve as file imports (civis_file_to_table, csv_to_civis, dataframe_to_civis) so they can easily override Platform's auto detection.

elsander commented 4 years ago

I believe these functions do use that endpoint (e.g. https://github.com/civisanalytics/civis-python/blob/1bd14e63ca8e0b6c98bea0f2cc06f8b6233dd1f8/civis/io/_tables.py#L1028). Can you say more about what you're looking for here?

jacksonlee-civis commented 3 years ago

As of v1.15.1 released in October 2020, the I/O functions in question all have the table_columns param as desired:

civis_file_to_table: https://github.com/civisanalytics/civis-python/blob/v1.15.1/civis/io/_tables.py#L898-L902

csv_to_civis: https://github.com/civisanalytics/civis-python/blob/v1.15.1/civis/io/_tables.py#L766-L770

dataframe_to_civis: https://github.com/civisanalytics/civis-python/blob/v1.15.1/civis/io/_tables.py#L616-L620