Skip to main content

Questions tagged [sql]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2 votes
1 answer
80 views

How can I make SQL output readable?

I'm trying to find an Emacs replacement for SQL Server Management Studio (SSMS). I have managed to query my Microsoft SQL Server from Emacs – and what a task that was! – through SQL Mode. However, the ...
J. Mini's user avatar
  • 121
0 votes
1 answer
103 views

How to export a PostgreSQL DB model to an org-mode file with tables

Having a PostgreSQL DB model defined in SQL, i would like to generate an org-mode file with a bunch of org mode tables to document it. So for each CREATE TABLE, it creates an org-mode table with its ...
nephewtom's user avatar
  • 2,281
0 votes
0 answers
62 views

Eglot and MS SQL

I was looking for a way to use Eglot with the MSSQL Server. I found this GitHub repo https://github.com/emacs-lsp/lsp-mssql, but this is for lsp-mode and not for Eglot. Is there an Eglot configuration/...
Bongo's user avatar
  • 101
0 votes
2 answers
178 views

lsp mode with mysql

Can lsp mode be used with a mysql server. I've setup lsp for some languages but cannot succeed with mysql. So far to connect I use emacsql package with a sql-connection-alist defined. This is what I ...
Michel Lecomte's user avatar
2 votes
4 answers
575 views

How can I query an existing SQLite database from elisp, that is, non-interactively?

There are multiple questions with "sqlite" in the title, but they all want to run SQL queries interactively, which sql-mode does. What I want is the following: I have a pre-existing SQLite ...
Betta George's user avatar
0 votes
0 answers
70 views

How to use Emacs Pinentry with Org-mode Bash source Blocks?

Main Problem I wanted to be more secure and convenient with my passwords and encryption so I have been trying to make GPG with Emacs work for my password store and SSH agent. I have Emacs-Pinentry ...
Zain Jabbar's user avatar
2 votes
0 answers
184 views

Reference env variable in org babel source block headers

I am setting up an org-mode document to connect to a postgreSQL database and execute+show the results of some queries. I don't want the database password visible in the org document (regardless of ...
dlid's user avatar
  • 121
0 votes
0 answers
636 views

Emacs as database client?

Linux Mint 20.2 Emacs 27.2 In my work I use the next DBs: PostgreSQL SQLite MySQL Oracle MS SQlServer So I need different database client to work with it. It's not very convenient. So, the question ...
a_subscriber's user avatar
  • 4,174
2 votes
2 answers
354 views

Storing Database Authentication Details Securely

(Note: I would normally use gpg versions of these files but for debugging I've scrapped gpg until I can get it working without encrypting!) I'd like to store my username/password credentials securely ...
Phil's user avatar
  • 535
0 votes
1 answer
1k views

How do I open an sqlite database from elisp?

I have a filepath for a sqlite database. I want to open an sql client buffer. I would like to know the best way to open that database from elisp. So far I can see that sql-sqlite will open it but it ...
gburnett's user avatar
  • 165
2 votes
2 answers
209 views

Can syntax parsing recognize the SQL '' (escape apostrophe/single quote) construct within SQL strings?

I am trying to enhance SQL mode such that editing of files of SQL code becomes more convenient, especially as far as jumping around is concerned (e.g. things like sql-goto-end-of-string etc.). I have ...
fsavigny's user avatar
0 votes
1 answer
74 views

Mode to edit SQL code inside XML tags [duplicate]

I'm new to emacs, does anybody know is there a way to combine xml-mode and sql-mode so SQL code inside tags can be highlighted and proper indent? example <FnTable ID="MyCode"> declare @ID ...
javierecf's user avatar
6 votes
2 answers
829 views

How to copy org-table to postgresql database?

With sqlite one can easily populate a table in a database via a org-table like so: [EDIT](using only one sqlite-scr-block with org-table variable parameter)[/EDIT] #+NAME: A | val1 | val2 | |------+...
kai-dj's user avatar
  • 427
2 votes
1 answer
1k views

Set the password for sql-postgres

I have a question regarding connecting to a sql database programmatically. Ideally I would like to have a function with similar functionality to the sql-postgres but instead of interactively prompting ...
Zac Romero's user avatar
2 votes
1 answer
1k views

Is possible to execute sql query direct in org mode?

windows 10, emacs 26.1 I know that in org mode I can insert source code and execute them. Nice. But what about sql: Here in my.org file: #+name: some_query #+BEGIN_SRC sql SELECT * FROM ...
a_subscriber's user avatar
  • 4,174
1 vote
1 answer
540 views

org-babel-execute:sql: receiving errors and no returns

#+name: Part 1 Task 1 #+header: :engine mysql #+header: :dbhost localhost #+header: :dbuser subject #+header: :dbpassword 1234 #+header: :database hmsec #+begin_src sql SELECT sensorId, type, ...
Meltinglava's user avatar
4 votes
1 answer
831 views

can emacs be taught what tables exist in a sql database

In emacs (in whatever mode you recommend for accessing a Postgres database) is it possible to type select * from foo_<tab> and somehow get autocomplete/help as to what tables are available ...
american-ninja-warrior's user avatar
3 votes
1 answer
649 views

Aggressive SQL indentation in emacs

I want an emacs SQL indentation function with the following properties: Upcase { select, from, as, where, group by, order by, asc, desc, and, or }. - EDIT: there are sqlup-mode.el and sql-upcase.el ...
Realraptor's user avatar
  • 1,293
2 votes
0 answers
48 views

How do I insert code block header :var in exported code block in org-mode for SQL

I cannot repeat solution mentioned in 27610 for SQL. Seems there is no org-babel-variable-assignments:sql function in org.el.
Dima Fomin's user avatar
0 votes
0 answers
230 views

Open multiple *SQL* buffers (same product)

I connect to postgres by placing the following in a file on a remote server, opening over tramp, and executing: (setq sql-connection-alist '((pool-my_db (sql-product 'postgres) ...
EoghanM's user avatar
  • 205
2 votes
0 answers
391 views

Org sql header args dont seem to work why?

Can anyone explain why this does not work, i want to set the parameters global to the current document using PROPERTY but this does not work and results in this error. (wrong-type-argument stringp ...
Oly's user avatar
  • 593
9 votes
3 answers
4k views

less psql, more emacs

I was listening to this song today - https://www.youtube.com/watch?v=ajy71xw351E Don't Wanna Leave You Now 🎵 🎶 and I realized how much I don't want to leave emacs. I often do this after ...
american-ninja-warrior's user avatar
2 votes
0 answers
703 views

How do you perform sql queries in emacs-lisp scripts?

I am building a database application to index org-mode files (http://kitchingroup.cheme.cmu.edu/blog/2017/01/03/Find-stuff-in-org-mode-anywhere/). The first iteration used emacsql, which worked well ...
John Kitchin's user avatar
  • 11.9k
3 votes
1 answer
418 views

What's the proper new-style form for passing header args to all sql code blocks?

I guess I've been out of the loop for a while. I used to have this at the end of my org-mode SQL files: #+PROPERTY: engine mysql #+PROPERTY: dbhost xx.xx.xx.xx #+PROPERTY: dbuser xxxxxx #+PROPERTY: ...
GaryO's user avatar
  • 496
2 votes
0 answers
87 views

How to use company-transform to uppercase SQL keywords

company-transform seems can be used to apply function on candidates. How to uppercase all SQL keywords which are in company complete candidates? only apply this transform function in SQL/NoSQL ...
stardiviner's user avatar
  • 1,948
1 vote
2 answers
235 views

Avoid to create a new window in sql mode

I use a monitor and a laptop screen as my multimonitor setup. Unfortunately the monitor and the laptop differs in resolution. So I use 2 frames, one frame on the monitor and one frame on the laptop ...
ReneFroger's user avatar
  • 3,900
4 votes
2 answers
2k views

How to change the indentation of major mode (SQL-mode)?

Configuration: Emacs 25.0.50 on Ubuntu 15.04. How to produce? Do emacs -Q, then M-x sql-mode. Paste the following in the buffer: SELECT SUM(T01.foobar) FROM db_foo.bar T01 WHERE T01.fooID = ...
ReneFroger's user avatar
  • 3,900
1 vote
0 answers
60 views

Edit Joomla Articles with Emacs

Editing Joomla articles in the web interface is the most pain the world. The articles in Joomla are stored in a mysql database. I'd like to figure out how I can connect a buffer to a "value" in ...
Jason Hunter's user avatar
2 votes
1 answer
256 views

How do I make multiple buffers use a single sql connection?

I am using sql mode. Is there a way to connect multiple buffers to a single sql connection? When I try to connect an existing buffer to a database, it always creates a new connection instead of ...
mandark's user avatar
  • 159
1 vote
0 answers
290 views

sql-connect: (setting-constant nil)

I am using latest Helm from MELPA on Emacs GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) of 2015-09-11 When I issue sql-connect I see this: The only connection I have saved (in ...
Manuel Uberti's user avatar
0 votes
1 answer
199 views

Switch syntax highlighting of open buffer from web-mode (freemarker) to sql

we use web-mode (freemarker engine) to edit source files that contain freemarker directives and a lot of SQL. Editing in web-mode (freemarker engine) works fine. It would be very helpful if we could ...
mbisping's user avatar
10 votes
2 answers
3k views

org-babel and remote sql commands

I'm using org-babel to do litterate programming and I find it very convenient. I am able to execute shell commands on remote hosts, and local database commands with the postgres client. To open a file ...
KookieMonster's user avatar
5 votes
2 answers
1k views

How to indent SQL code just 4 spaces, without alignment &c?

SQL mode has some cool stuff set up for indenting with aligned keywords and such. Normally, I'd think it was cool. The problem is that at my new job, the people who wrote our mountains of sql did not ...
user3113723's user avatar
0 votes
1 answer
489 views

Emacs connect to MySQL (MariaDB) non-interactively

I am looking into sql.el, and I can't find a way to bypass creating comint buffer and setting some global variables in order to connect to the database. This is less than ideal because I know the ...
wvxvw's user avatar
  • 11.4k
18 votes
4 answers
8k views

Automatically formatting SQL code

There are some general well-known coding standards and styles for SQL (e.g. capitalizing reserved words, placing main keywords in different lines, etc.). Does Emacs come with any modes for this, or ...
Amelio Vazquez-Reina's user avatar