Closed Mmoncadaisla closed 3 years ago
This pull request has been linked to Clubhouse Story #155055: [emily-mo] Inconsistent to_carto error.
Performed different Q&A tests on both an enterprise and a free plan accounts and it seems to be working as expected. Thank you a lot for the great CR @Jesus89 @jgoizueta ❤️
Context
In this small PR from Support we aim to avoid hitting the Batch API 16 kb payload limit when using the
_truncate_and_drop_add_columns
function, which is called fromto_carto
(throughcopy_from
) withif_exists='replace'
collision strategy if the table structure changes used and the table has a considerable amount of columns.Further context can be found here: https://app.clubhouse.io/cartoteam/story/155055/emily-mo-inconsistent-to-carto-error
Proposed solution
Example output with the current logic
Example output with the changes implemented
We have also verified that the temporary function is dropped as expected.
PR changes
Relevant
io/managers/context_manager.py
where the logic referred above is implemented. Add helper functions for query definition, add functions to create and drop UDFs and perform necessary changes in the_truncate_and_drop_add_columns
functionMinor
utils/utils.py
add a functioncreate_tmp_name
to create temporary-like names using uuid/data/services/service.py
adapt the_new_temporary_table_name
method to make use of thecreate_tmp_name
function