You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to bulk insert rows into a specific partition which all have the same date. Assume that data are partitioned by month on date_column. Does the architect API allow for:
p = get_partition(column_name='date_column', value='2015-01-01')
then run: "copy from '/my/file.txt' to %s" % p.table_name
Perhaps I am unclear on how to use the get_partition API. Can you provide an example?
The text was updated successfully, but these errors were encountered:
Unfortunately there is no API to get the partition name right now, neither in PostgreSQL nor in MySQL. In MySQL it's fairly easy to implement using existing code, but for PostgreSQL the partition name is constructed dynamically inside the trigger so we have to think about how to implement it properly in Architect, because your use case is perfectly valid and we need to add this API in one of the future versions.
The only thing that I can recommend you to do right now is to hardcode the partition name in your code if it's the one time operation, or if you plan to do this on a regular basis you can have a look at the generated partition names to get idea of the naming scheme and to implement a small function in Python somewhere in your code which will accept a date and return a generated partition name from it.
In MySQL you should have both options, in Postgres you need to insert one row into the table for partition to be created, because everything is managed through the triggers.
I want to bulk insert rows into a specific partition which all have the same date. Assume that data are partitioned by month on date_column. Does the architect API allow for:
p = get_partition(column_name='date_column', value='2015-01-01')
then run: "copy from '/my/file.txt' to %s" % p.table_name
Perhaps I am unclear on how to use the get_partition API. Can you provide an example?
The text was updated successfully, but these errors were encountered: