Indexing and Direct SQL Access

As far as I know, SQL Queries on Anvil Data Tables are only available for dedicated plans.

Is there a way to try these features on my local machine, without having a dedicated plan? The reason is that I want to try and develop my app first to see how well responds to my needs before I invest in a Dedicate Plan.

Thanks a lot, in advance.

Yes, you can use the open source app server locally on your own machine and you have full access to the embedded postgresql server.

1 Like

Or you can use an uplink script on your machine that has access to full python and resources in your machine.

Obviously every time you call an uplink function from a server module you do a round trip, and the transaction management will not be as flexible.

1 Like

Using uplink to have access to data tables through app_tables.tables... syntax is one approach. What I want to do is to retrieve the data with SQL queries like in the example below, which is in the docs. The one thing I know is that this feature is available to use through the browser if you acquire a dedicated plan. The one that I don’t know is if it is possible to use this kind of code in a local machine, without having a dedicated plan, of course.

import psycopg2
import anvil.tables

conn = psycopg2.connect(anvil.tables.get_connection_string())
with conn.cursor() as cur:
    cur.execute("SELECT * FROM users")
    all_users = list(cur)

Sorry, I meant you can use sql for your own database in your uplink machine.

No, you can’t access the Anvil database with sql without dedicated plan. @owen.campbell 's answer is your best option.

2 Likes