Ask Your Question
0

Export base queries to .sql [closed]

asked 2018-12-08 14:17:21 +0100

impocta gravatar image

I have accumulated a number of queries in libreoffice base. The large number of queries is causing the queries window to appear cluttered and thereby I'm don't have overview anymore. For this reason I decided I wanted to store my queries as .sql files and run them through mysql workbench. In that way I can order the queries (.sql files) in folders and keep a better overview.

One way to move the queries to .sql-files is by opening every base query in sql-view and copy-pasting the written commands. However, because that would be a labour intensive, repetitive job, I'm wondering if there is a way to do a batch export of base queries to .sql files.

I'm using Base 6.0.6 on Xubuntu 18.04

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by impocta
close date 2018-12-13 08:54:40.481194

3 Answers

Sort by » oldest newest most voted
1

answered 2018-12-08 19:51:31 +0100

Ratslinger gravatar image

updated 2018-12-08 19:54:58 +0100

Hello,

If you 'unzip' (archive manager) the .odb, in the main folder is a file "content.xml". Open this file with a browser and you will find all the queries in one section - db.queries

From there you it should be a bit easier to copy & paste.

As for exporting to .sql files, you can most likely do this by writing a macro to read the query statement & then write each to a file. Not sure which involves more work.

edit flag offensive delete link more

Comments

thanks, I tried the unzipping, it saved me some time.

impocta gravatar imageimpocta ( 2018-12-08 20:32:40 +0100 )edit
0

answered 2018-12-09 06:35:53 +0100

pierre-yves samyn gravatar image

Hi

There is an extension for this.

I haven't tried it. The documentation seems to be complete and well detailed.

HTH. Regards

edit flag offensive delete link more

Comments

@pierre-yves samyn BaseDocumenter is only for HSQLDB currently. Question deals with MySQL. Have personally tried in Linux & it was unacceptable to me.

Ratslinger gravatar imageRatslinger ( 2018-12-09 06:53:40 +0100 )edit

Hi @Ratslinger

Question deals with MySQL

I should have seen it indeed. Thank you for the feedback...

Regards

pierre-yves samyn gravatar imagepierre-yves samyn ( 2018-12-09 09:32:30 +0100 )edit
0

answered 2018-12-08 19:17:41 +0100

John99 gravatar image

Not a batch export method but I wonder if this is any less labour intensive: "You copy a table from Base to a new Calc sheet, then you can save or export the data to any file format that Calc supports.

  1. Open the database file that contains the database table to be exported. Click Tables to view the tables, or click Queries to view the queries.
  2. Choose File - New - Spreadsheet.
  3. In the Base window, right-click the name of the table to export. Choose Copy from the context menu.
  4. Click cell A1 in the new Calc window, then choose Edit - Paste.

Now you can save or export the data to many file types."

edit flag offensive delete link more

Comments

@John99 I believe the question is about the Query text and not the tables in Base.

Ratslinger gravatar imageRatslinger ( 2018-12-08 19:27:15 +0100 )edit

Ratslinger is correct

impocta gravatar imageimpocta ( 2018-12-08 20:17:49 +0100 )edit

Question Tools

2 followers

Stats

Asked: 2018-12-08 14:17:21 +0100

Seen: 41 times

Last updated: Dec 09