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
The sqlserver adapter drops and creates a function every time the class is loaded.
In a corporate production environment, dropping and adding functions is often strictly controlled.
What's more, if you're running more than one instance of the app, there is a chance that instance 2 will fire up and drop the function while instance 1 is trying to use the function.
Finally, if you're using flat_distance_sql instead of sphere_distance_sql, you will never need the created function.
For all these reasons, I think the creation of that sql function should be a class method, not run on load. It should be a one-time operation for any database that the developer should be responsible for running - say in a migration or what have you. Ideally you should catch the appropriate sql error that would result from calling sphere_distance_sql without that method and document what the developer needs to do to make it work.
p.s. I hate sql server for not having a least function.
The text was updated successfully, but these errors were encountered:
The sqlserver adapter drops and creates a function every time the class is loaded.
In a corporate production environment, dropping and adding functions is often strictly controlled.
What's more, if you're running more than one instance of the app, there is a chance that instance 2 will fire up and drop the function while instance 1 is trying to use the function.
Finally, if you're using flat_distance_sql instead of sphere_distance_sql, you will never need the created function.
For all these reasons, I think the creation of that sql function should be a class method, not run on load. It should be a one-time operation for any database that the developer should be responsible for running - say in a migration or what have you. Ideally you should catch the appropriate sql error that would result from calling sphere_distance_sql without that method and document what the developer needs to do to make it work.
p.s. I hate sql server for not having a least function.
The text was updated successfully, but these errors were encountered: