A Linux box sends measurements to AWS-RDBMS. A python script opens and closes the connection only long enough to upload data to the database (sessions is closed immediately after update). The alternative is that the box opens up an indefinite session to the database and update the RDBMS: not sure what problems would be with this if the internet connection failed and unsure of the degree of the connection's 'persistence' when faced with unstable internet connection. At scale, there could be hundreds of measurement boxes uploading data to the RDBMS.
What is the best practice with regard to python IoT session connection duration? Is it best practice to close the session after transmitting the data? Maybe define an idle time that starts after data is transmitted: if the idle time reaches more than a predefined amount of time then close the channel. Bonus for any explanation of the why behind the best practice.
Perhaps this question is dependent on the platform? i.e. RDBMS vs AWS Greengrass?