Skip to content

Commit 8264cfd

Browse files
authored
Merge pull request #41 from juarezr/feat/sql
Add SQL Support
2 parents 3729eec + 2692c3a commit 8264cfd

8 files changed

Lines changed: 337 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
## [0.3.0] - 2025-09-12
66

7+
### Added
8+
- Support to generate SQL statements for querying and modifying database tables (in #41, thanks to @juarezr)
9+
10+
## [0.3.0] - 2025-09-12
11+
712
### Added
813

914
- Markdown table support (thanks to @juarezr)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Or you can specify the `pastum.defaultDataframeR`/`pastum.defaultDataframePython
4040
- Julia: `DataFrames.jl`
4141
- JavaScript: `base`, `polars 🐻`, `arquero 🏹`, `danfo 🐝`
4242
- Markdown: `columnar ↔️`, `compact ↩️`
43-
- SQL: work in progress
43+
- SQL: many options to generate SELECT, INSERT, UPDATE, MERGE, AND CREATE TABLE statements.
4444

4545
`pastum` recognises tables in the following formats: text, HTML, CSV, TSV.
4646

extension.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const py = require("./src/paste-python.js");
44
const jl = require("./src/paste-julia.js");
55
const js = require("./src/paste-js.js");
66
const md = require("./src/paste-markdown.js");
7+
const sql = require("./src/paste-sql.js");
78
const def = require("./src/paste-default.js");
89

910
function activate(context) {
@@ -28,6 +29,10 @@ function activate(context) {
2829
"pastum.Markdown",
2930
md.clipboardToMarkdown
3031
),
32+
vscode.commands.registerCommand(
33+
"pastum.Sql",
34+
sql.clipboardToSql
35+
),
3136
vscode.commands.registerCommand("pastum.Defaultdataframe", def.pasteDefault)
3237
);
3338
}

package.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "pastum",
33
"displayName": "Pastum",
4-
"description": "Convert table from clipboard to R, Python, Julia, JS or Markdown dataframe",
5-
"version": "0.3.0",
4+
"description": "Convert table from clipboard to R, Python, Julia, or JS dataframes and also to SQL or Markdown",
5+
"version": "0.3.1",
66
"publisher": "atsyplenkov",
77
"license": "MIT",
88
"pricing": "Free",
@@ -54,6 +54,11 @@
5454
"title": "Table ➔ JavaScript Dataframe",
5555
"category": "Pastum"
5656
},
57+
{
58+
"command": "pastum.Sql",
59+
"title": "Table ➔ SQL",
60+
"category": "Pastum"
61+
},
5762
{
5863
"command": "pastum.Markdown",
5964
"title": "Table ➔ Markdown",
@@ -153,6 +158,22 @@
153158
],
154159
"default": "columnar ↔️",
155160
"markdownDescription": "Select the default aligment for Markdown tables to be pasted using the `pastum.Defaultdataframe` command."
161+
},
162+
"pastum.defaultSqlStatement": {
163+
"type": "string",
164+
"enum": [
165+
"SELECT FROM VALUES",
166+
"SELECT UNION ALL",
167+
"INSERT INTO VALUES",
168+
"INSERT INTO SELECT VALUES",
169+
"INSERT INTO",
170+
"DELETE WHERE",
171+
"UPDATE WHERE",
172+
"MERGE INTO",
173+
"CREATE TABLE"
174+
],
175+
"default": "INSERT INTO VALUES",
176+
"markdownDescription": "Select the default SQL statement to be pasted using the `pastum.Defaultdataframe` command."
156177
}
157178
}
158179
}
@@ -167,4 +188,4 @@
167188
"@vscode/test-electron": "^2.5.2",
168189
"typescript": "^5.9.2"
169190
}
170-
}
191+
}

src/paste-default.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const py = require("./paste-python.js");
44
const jl = require("./paste-julia.js");
55
const js = require("./paste-js.js");
66
const md = require("./paste-markdown.js");
7+
const sql = require("./paste-sql.js");
78

89
function pasteDefault() {
910
// Get the default dataframe framework
@@ -12,6 +13,7 @@ function pasteDefault() {
1213
const framePy = config.get("defaultDataframePython");
1314
const frameJS = config.get("defaultDataframeJavascript");
1415
const frameMD = config.get("defaultAligmentMarkdown");
16+
const frameSql = config.get("defaultSqlStatement");
1517

1618
// Get the active editor language
1719
const editor = vscode.window.activeTextEditor;
@@ -37,6 +39,9 @@ function pasteDefault() {
3739
case "markdown":
3840
md.clipboardToMarkdown(frameMD);
3941
break;
42+
case "sql":
43+
sql.clipboardToSql(frameSql);
44+
break;
4045
default:
4146
vscode.window.showErrorMessage("No default framework selected");
4247
}

0 commit comments

Comments
 (0)