DBeaver, export from database Postgres, table structure (properties) into file .txt
Asked Answered
M

5

80

I have little problem with DBeaver. I want to export my structure from each table from database in file .txt. I found how to export all data but I don't need this data, just table structure. If you have some solutions for export table structure .csv it'll be good.

Here is a an image about structure of the table:

https://imgur.com/a/oTVMFhw

Magdalen answered 27/7, 2018 at 7:4 Comment(2)
Did you found any solution for this?Anabas
I think the solutions below won't answer the actual question. The question is to show the table, not the query. I think there is no direct feature, we need to do DESC query and copy as textAggappera
M
135

If you are happy to have the table structures as SQL CREATE statements, then you can just go to the navigator panel on the left, into "Tables", select all the tables, then right click and Choose "Generate SQL" -> DDL

Mackoff answered 3/2, 2019 at 15:37 Comment(4)
When trying to run the script generated I get error in SQL syntax. If I run the create statements one by one however then they all get created.Harelda
This method of generating DDL does not maintain the correct table order. Child tables can come before parent tables and cause errors with foreign key references.Krutz
@AmitNaidu, do you have a way to create DDL in correct table and view order?Grantham
@PURVESHPATEL there's an option "separate foreign keys" (or something like that, 'cause I'm using pt-br version).Palestine
M
76

Click on Tables -> Views Tables -> Select All tables in right window Right click selection -> Generate SQL" -> DDL

Marijuana answered 9/7, 2019 at 8:54 Comment(0)
K
1

I tried like this:

  • Doubleclick the table columns
  • Select all the columns
  • Choose right click the mouse and select copy advanced info
  • Open an Excel -> paste special -> choose text option
  • All your table data structure will be in the Excel sheet
Killjoy answered 15/4, 2020 at 5:53 Comment(3)
This is a bad option. Imagine a situation where I have a DB of 15+gb? Probably the data doesnt even fit the RAM to be copy/pasted. You machine would just freeze.Petulah
The answer is fine, you can copy advanced just the table meta without the actual dataHobnailed
Yes, this is fine. This also worked for me. All you want, and get is the table column names, datatypes etc.Dearly
F
1

Just select all columns in table Properties and choose Advanced Copy in right click menu

enter image description here

Forsythia answered 5/4, 2024 at 17:52 Comment(0)
C
0

to download the general database to .sql

and click "Start"

Cerotype answered 16/6, 2023 at 19:42 Comment(3)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Delisle
I actually found this useful, and the only question that solved the answer. (No one else mentioned the export functionality).Anselmi
It seems that getting data inserts/copy is mandatory. A pity there is no option to skip data and only export structure. Have I missed it maybe?Talie

© 2022 - 2025 — McMap. All rights reserved.