Aws Serverless PostgreSql with Anvil

Currently, I am on free account so obviously can’t access external database. Just trying out anvil. I am using anvil’s built in database. If at some point I switch to Amzon’s serverless postgresql, Can I do that easily without massive code rewrite? I think app_tables.search() like functions will work with aws serverless architecture. Has anyone tried this?

Hi @ehsensiraj, As far as I know, it doesn’t work, but more information about the Amzon’s serverless postgresql is required

Could you kindly give a link to Amzon’s serverless postgresql? Thanks

Here is the link:

Thanks @ehsensiraj, app_tables.search() will work if using the open source app server. I am not too sure about the hosted app

1 Like

Hi @ehsensiraj,

You can access any external database, using the standard Python database libraries. (So, if you’re using Postgres, you’ll want psycopg2, perhaps with something like SQLAlchemy on top of it.) Here’s a walk-through example of connecting to a cloud-hosted Postgres database from an Anvil app:

Anvil’s Data Tables are a little different – if you want to use functions like app_tables.my_table.search(), you’ll want to stick to using the built-in Data Tables hosted by us. (They’re built on top of Postgres, but you can’t connect them to any old Postgres database - we do a lot of built-in management :slight_smile: )

4 Likes