Are you on Prefect Cloud or Server? If you are on Prefect Cloud, the database access is disabled for security, performance and other reasons. Instead, you can query the data using GraphQL API
If you are on Server, you manage the database yourself so you have the access to it.
LMK if something is still unclear