Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Added

- Support to generate SQL statements for querying and modifying database tables (in #41, thanks to @juarezr)
- Markdown table support (thanks to @juarezr)
- TSV and CSV table support (thanks to @juarezr)
- `pastum.libraryDeclaration` configuration option, which allows the user to add library declaration to the pasted dataframe. (#18)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Or you can specify the `pastum.defaultDataframeR`/`pastum.defaultDataframePython
- Julia: `DataFrames.jl`
- JavaScript: `base`, `polars 🐻`, `arquero 🏹`, `danfo 🐝`
- Markdown: `columnar ↔️`, `compact ↩️`
- SQL: work in progress
- SQL: many options to generate SELECT, INSERT, UPDATE, MERGE, AND CREATE TABLE statements.

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

Expand Down
5 changes: 5 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const py = require("./src/paste-python.js");
const jl = require("./src/paste-julia.js");
const js = require("./src/paste-js.js");
const md = require("./src/paste-markdown.js");
const sql = require("./src/paste-sql.js");
const def = require("./src/paste-default.js");

function activate(context) {
Expand All @@ -28,6 +29,10 @@ function activate(context) {
"pastum.Markdown",
md.clipboardToMarkdown
),
vscode.commands.registerCommand(
"pastum.Sql",
sql.clipboardToSql
),
vscode.commands.registerCommand("pastum.Defaultdataframe", def.pasteDefault)
);
}
Expand Down
27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "pastum",
"displayName": "Pastum",
"description": "Convert table from clipboard to R, Python, Julia, JS or Markdown dataframe",
"version": "0.3.0",
"description": "Convert table from clipboard to R, Python, Julia, or JS dataframes and also to SQL or Markdown",
"version": "0.3.1",
"publisher": "atsyplenkov",
"license": "MIT",
"pricing": "Free",
Expand Down Expand Up @@ -54,6 +54,11 @@
"title": "Table ➔ JavaScript Dataframe",
"category": "Pastum"
},
{
"command": "pastum.Sql",
"title": "Table ➔ SQL",
"category": "Pastum"
},
{
"command": "pastum.Markdown",
"title": "Table ➔ Markdown",
Expand Down Expand Up @@ -153,6 +158,22 @@
],
"default": "columnar ↔️",
"markdownDescription": "Select the default aligment for Markdown tables to be pasted using the `pastum.Defaultdataframe` command."
},
"pastum.defaultSqlStatement": {
"type": "string",
"enum": [
"SELECT FROM VALUES",
"SELECT UNION ALL",
"INSERT INTO VALUES",
"INSERT INTO SELECT VALUES",
"INSERT INTO",
"DELETE WHERE",
"UPDATE WHERE",
"MERGE INTO",
"CREATE TABLE"
],
"default": "INSERT INTO VALUES",
"markdownDescription": "Select the default SQL statement to be pasted using the `pastum.Defaultdataframe` command."
}
}
}
Expand All @@ -167,4 +188,4 @@
"@vscode/test-electron": "^2.5.2",
"typescript": "^5.9.2"
}
}
}
5 changes: 5 additions & 0 deletions src/paste-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const py = require("./paste-python.js");
const jl = require("./paste-julia.js");
const js = require("./paste-js.js");
const md = require("./paste-markdown.js");
const sql = require("./paste-sql.js");

function pasteDefault() {
// Get the default dataframe framework
Expand All @@ -12,6 +13,7 @@ function pasteDefault() {
const framePy = config.get("defaultDataframePython");
const frameJS = config.get("defaultDataframeJavascript");
const frameMD = config.get("defaultAligmentMarkdown");
const frameSql = config.get("defaultSqlStatement");

// Get the active editor language
const editor = vscode.window.activeTextEditor;
Expand All @@ -37,6 +39,9 @@ function pasteDefault() {
case "markdown":
md.clipboardToMarkdown(frameMD);
break;
case "sql":
sql.clipboardToSql(frameSql);
break;
default:
vscode.window.showErrorMessage("No default framework selected");
}
Expand Down
Loading