I have never used an external database with Anvil, but I think using uplink is not the right way. I think using a connection to the external database will manage exceptions, transactions, caching, etc. for you, while using uplink you would be in charge of all of that.
Another consideration about using an external database is the Users service: the Users service uses the
Users table in the Anvil database, I think it is impossible to use another database for it. So, you either leave the Users table in Anvil and the rest on your own external database, or you redesign your own user management that uses the external database. (Or I am wrong, and it is possible)
I started my first reply by describing my use case and by saying “My first priority is my own productivity” because I know you are in a different place.
Still, since we are talking about Anvil/Python and you like C#/strong typing, I thought this digression would add some value to the discussion.
Just to pick an example, I have posted two custom components in this forum: DataGridJson and InputBox. I have done similar dynamic UIs in VBA, VB6, Python and other proprietary scripting languages, all with flexible typing. All did their job and some are still used after decades.
I also have done something similar in C#. Managing a json without schema as input and all those input components with slightly different behavior was a nightmare of generics and types and classes. The final result was a strongly typed component, very easy to use, covered by tests. But it took me 10 times longer to develop and it was impossible to understand unless you dug through all the classes.
Using Python I feel confident that if I (or the worst coder in the team) need a change in behavior next year, when I forgot how those components work, I can just open them, understand them, change one line of code and get the new behavior. (It has happened already many times.)
Using C# I was never able to get something old that I had forgotten, quickly understand what happens inside, and change its behavior without adding more and more classes or butchering the whole thing.
I’m not mentioning the DataGridJson or InputBox to show how a component should be done in Python. They are far from perfect. Very far! That’s the point: in Python you can be sloppy and get the job done.
I am mentioning them as a success story: it was fast and easy to create them, it will be easy to maintain them, they just work. No, they don’t have tests, because they are so simple that they don’t need tests. The same beast in C# would need tests, because it would be so complex that I wouldn’t trust it without tests.