Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty cornucopia.rs file after running CLI live command against local Postgres. #260

Open
aaronpeacock opened this issue Nov 13, 2024 · 4 comments

Comments

@aaronpeacock
Copy link

aaronpeacock commented Nov 13, 2024

  1. I run this command: cornucopia live postgres://ogreets3:0gr33t5@localhost:5432/og3_CornucopiaMe
  2. No error. Nearly instant processing. It didn't generate anything, really.

My cornucopia.rs file looks like this:

// This file was generated with `cornucopia`. Do not modify.

 #[allow(clippy::all, clippy::pedantic)] #[allow(unused_variables)]
#[allow(unused_imports)] #[allow(dead_code)] pub mod types { } #[allow(clippy::all, clippy::pedantic)] #[allow(unused_variables)]
#[allow(unused_imports)] #[allow(dead_code)] pub mod queries
{ }

Next:
I try 'schema' command:

aaron@aaron-hp:~/Documents/cornucopia_test$ cornucopia schema ./database_sql.sql
Error: × Couldn't establish a connection with the database.
├─▶ error communicating with the server: Connection reset by peer (os error 104)
╰─▶ Connection reset by peer (os error 104)

I run it again:
2)
same error...
3)
same error...

aaron@aaron-hp:~/Documents/cornucopia_test$ cornucopia schema ./database_sql.sql
Error: × Couldn't establish a connection with the database.
├─▶ error communicating with the server: Connection reset by peer (os error 104)
╰─▶ Connection reset by peer (os error 104)

  1. after about 10 attempts and errors, I retry and finally get a generated cornucopia.rs file...

and it's the same:

// This file was generated with `cornucopia`. Do not modify.

 #[allow(clippy::all, clippy::pedantic)] #[allow(unused_variables)]
#[allow(unused_imports)] #[allow(dead_code)] pub mod types { } #[allow(clippy::all, clippy::pedantic)] #[allow(unused_variables)]
#[allow(unused_imports)] #[allow(dead_code)] pub mod queries
{ }

I can assure you that the SQL file and the DB have dozens of tables and then about a dozen alter table add foreign_key statements, such that there should be something, or at least an error if not.

@aaronpeacock
Copy link
Author

cornucopia -V
0.9.0

I pulled directly from git, per
cargo install --git https://github.com/cornucopia-rs/cornucopia.git cornucopia

@242816
Copy link

242816 commented Nov 14, 2024

If you go into Postgres psql postgres://ogreets3:0gr33t5@localhost:5432/og3_CornucopiaMe and type \dt how many tables does it show?

@aaronpeacock
Copy link
Author

If you go into Postgres psql postgres://ogreets3:0gr33t5@localhost:5432/og3_CornucopiaMe and type \dt how many tables does it show?

27 rows = 27 tables in the public schema

@aaronpeacock
Copy link
Author

FWIW, I can process the same database fine with other tools.
(relevant = https://github.com/ptechen/sql_reverse is capable of looping through the tables)

I would also say that the Cornucopia book is great, it looks really nice.
I think it could use at least 1 or 2 CLI examples:
one for 'schema' and one for 'live'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants