Questions tagged [sql]
The sql tag has no summary.
38 questions
0
votes
0
answers
24
views
Why is the register being cleared after ejc-sql initialization?
I've encountered an issue where one of my Emacs registers (specifically register 'e') is being cleared shortly after ejc-sql initializes. I've narrowed down the timing to about 7 seconds after Emacs ...
0
votes
1
answer
87
views
Using sql-ms with sqlcmd
I am trying to set up emacs as a database client for a MS SQL Server database with the sql-ms command. I've come across a few different tutorials and questions related to this.
However, I am running ...
0
votes
1
answer
55
views
How to qualify a column name in a SQL query passed to emacsql?
Some context
I'm querying my org-roam database, which is using the default sqlite3 format.
The code I expected to work
When I pass the following query to emacsql:
[:select [source title nodes....
0
votes
1
answer
56
views
Is the Postgres documentation's Emacs code for using a Postgres mode bugged?
The Postgres documentation contains this code
;; check for files with a path containing "postgres" or "pgsql"
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.[ch]\\...
2
votes
1
answer
369
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 ...
0
votes
1
answer
162
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 ...
0
votes
2
answers
343
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 ...
2
votes
4
answers
1k
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 ...
0
votes
0
answers
116
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 ...
2
votes
0
answers
246
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 ...
0
votes
0
answers
773
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 ...
2
votes
2
answers
594
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 ...
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 ...
2
votes
2
answers
301
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 ...
0
votes
1
answer
92
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 ...
6
votes
2
answers
911
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 |
|------+...
3
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 ...
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 ...
1
vote
1
answer
599
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, ...
4
votes
1
answer
931
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 in ...
3
votes
1
answer
690
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 ...
2
votes
0
answers
61
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.
0
votes
0
answers
249
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)
...
2
votes
0
answers
416
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 ...
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 ...
2
votes
1
answer
829
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 ...
3
votes
1
answer
448
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: ...
2
votes
0
answers
91
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 buffers,...
1
vote
2
answers
265
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 ...
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 = ...
1
vote
0
answers
62
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 ...
2
votes
1
answer
276
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 ...
1
vote
0
answers
321
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 ...
0
votes
1
answer
209
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 ...
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 ...
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 ...
0
votes
1
answer
577
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 ...
19
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 ...