Is the following bad practice?
def add_license_to_database(license: License) -> str:
db = firestore.client()
... # Proceed to add license object
i.e. – is it better to create the client outside the function as a singleton?
Profiling shows that the db = firestore.client()
takes only about 20 microseconds, so I’m guessing it’s fine – but I just want to check if there are any reasons (performance or otherwise), to use a singleton object for the firestore client instead of recreating it on each function call.