Your database looks empty

I’m just running the basic setup steps with npm (lumber generate) with a postgres database and trying to connect to my public schema (the default setting). Other tools have no issue connecting with providing the same creds/host.
I’ve also tried the same with the docker-steps and get the same problem.

Expected behavior

the tool connects to the database and loads all the schemas available to the user

Actual behavior

✓ Connecting to your database
:heavy_multiplication_x: Analyzing the database

Your database looks empty! Please create some tables before running the command.
If not, check whether you are using a custom database schema (use in that case the --schema option).

Context

Please provide any relevant information about your setup.
versions are whatever the latest is as of writing this ticket

  • Database Dialect: postgres
  • Database Version: 12.4

Hello @auser and welcome to the Forest Admin community!

Did you make sure you have selected the right parameters? user credentials, database name/port ?
Is it possible for you to run this query against your database and post me the result?

SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'public'

Let me know what you get :grinning:

1 Like

Hello :slight_smile:
I get pg_stat_statements.

Re: your question about creds. Yes, I triple-checked. I also specified one of our many schemas in the same DB to see what would happen. There’s a different error there which might be a different problem to solve. But at least it shows that forest is able to read some info from the DB.

Model creation error: Error: A column called ‘id’ was added to the attributes of ‘mytable’ but not marked with ‘primaryKey: true’

Hello @auser,

Getting only pg_stat_statements seems odd to me.
Can you check that the database-name was properly entered? It should be visible in the DATABASE_URL of your .env file (if created)?

Hello @anon79585656,
It was entered correctly yes. It’s in the DATABASE_URL in the .env file.

Hello @auser,

Can you locate your tables in the result of this query:

SELECT * FROM INFORMATION_SCHEMA.TABLES

Is it possible to copy/paste these rows?

The previous query you ran lists all tables of the public schema in your database. As it’s only showing pg_stat_statements, it indicates that your public schema on this database is only containing this table (which is a technical view, created by postgresql).

So, it means that there is an issue, either with the name of the database, the schema, or with the connection parameters to your server (and that you’re not connected to the right database).

I can see all my tables in that response.
I can’t paste the results verbatim here on a public forum. But maybe you could tell me what to look for?

I even tried just setting up a project with the forest demo database and that fails to all setup properly as well. So seems there’s something else going on. Searches show a recent bug in local dev environments that was claimed fixed, but not sure if that fix has been released.

Hello @auser,

Sorry for the hard time you’re having to make your setup work.

I was quite scared when reading your message so I’ve just tried to create a new project with the forest demo database. I’m relieved, everything worked well on my side. But it doesn’t help you out with your issue.

So if you have trouble to create a project with the demo database, the issue is probably not related to your database.
Can you tell me what problem did you face when trying with the demo DB?
Was it during the DB connection? If so, can you show us what credentials did you put in the DB form?

Thanks for your patience.

Hello @auser,

I guess if you run this query against your database:

SELECT table_name, table_schema FROM information_schema.tables

You will be able to determinate which table is related to its schema.
You mentionned, the schema should be public.
Is that the case when running this query?
Do the tables you want to show are related the the public schema?

Let me know :wink:

The tables are related to different schemas than public. I only had public chosen because it’s the default setting and I assumed that meant forest would just read all schemas available to the user. But it sounds like my assumption was wrong and you can only target one schema at a time?

1 Like

I believe it was after running the backend-setup command and then watching for the connection to succeed on the web-page, it threw an error popup saying could not connect to localhost:3310 or similar. I was using ubuntu 20 with the creds given in the docs. I even tried on a fresh desktop VM to reduce problem factors, but got the same result.
Sorry I can’t provide any more info. I’ve moved on from trying to solve this. So this issue does not need to stay open on my behalf.