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

Allow to export without quotes #1896

Open
silvioprog opened this issue May 18, 2019 · 7 comments
Open

Allow to export without quotes #1896

silvioprog opened this issue May 18, 2019 · 7 comments
Labels
enhancement Feature requests.

Comments

@silvioprog
Copy link

Hello.

It would be nice to export metadata without quotes (menu File | Export | Database to SQL file...). For example, currently it export as:

CREATE TABLE IF NOT EXISTS "countries" (
	"id"	INTEGER NOT NULL,
	"name"	VARCHAR(50) NOT NULL UNIQUE,
	PRIMARY KEY("id")
);

however, it would be nice any option to export as:

CREATE TABLE IF NOT EXISTS countries (
	id	INTEGER NOT NULL,
	name	VARCHAR(50) NOT NULL UNIQUE,
	PRIMARY KEY(id)
);

Thank you!

@justinclift
Copy link
Member

Shouldn't be too hard to make happen. What's the scenario where it'd be useful? 😄

@Z4us
Copy link

Z4us commented May 18, 2019 via email

@mgrojo
Copy link
Member

mgrojo commented May 18, 2019

The difficult part is that in order to do it well, you have to check that the identifier doesn't have any unusual character or it isn't an SQL keyword, otherwise the result will be invalid.

Note that you can choose the quote character to use in "Edit > Preferences > SQL", just in case you prefer other style over the default SQL standard.

Edit: Just saw @Z4us' similar answer.

@justinclift
Copy link
Member

Good point. Sounds like it could turn out to be tricky to implement well. 😦

@silvioprog
Copy link
Author

It would be useful for who wants less verbose SQL, specially people using screen reader. Many other tools (SQLite Studio, DBeaver etc.) allows it, so IMHO SQLite Browser should allow it too.

I found the Edit > Preferences > SQL, but unfortunately it doesn't provide any option to disable the quoting. I really would like some option None there, because I'm removing the quotes manually all the time. I could use SQLite Studio/DBeaver to generate SQL without quotes, but their generated SQL uses an ugly formatting (lot of spaces, tabs, break lines or single line). SQLite Browser generates a very clean SQL, the only problem is the lot of quotes which we have to remove manually. (Quotes are useless for me, because my tables/fields names contains only "a..z" characters)

Below, the same table exported trough SQLite Studio, notice the lot of useless spaces, but no quotes:

CREATE TABLE companies (
    id         INTEGER       PRIMARY KEY
                             NOT NULL,
    name       VARCHAR (50) UNIQUE
                             NOT NULL
                             CHECK (LENGTH(name) > 2),
    address_id INTEGER       REFERENCES addresses (id) ON DELETE CASCADE
                                                       ON UPDATE CASCADE
                             NOT NULL
);

@justinclift justinclift added the enhancement Feature requests. label May 18, 2019
@sky5walk
Copy link

On the contrary, my fields intentionally carry myX(Y) requiring quoting.
Not sure if it would work, but add an export option for quoting which allows ""(empty space).

@chrisjlocke
Copy link
Member

Couldn't you use a character you wouldn't use, eg, £ as the quote character, then a search/replace would remove all those £ characters...

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

No branches or pull requests

6 participants