question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generic Generate SQL Feature/Idea (SQL templates for Generate SQL and Export to SQL)

See original GitHub issue

The generate sql feature is similar the export as sql feature in Heidisql. One thing I’ve used in the past is export as sql and choose REPLACE INTO as the command.

Is it possible to export all of the result set of a sql query as REPLACE INTO queries? It seems like the generate sql feature only works on visible result sets, and I need all of it.

Now adding every sql extension is probably not scalable. So perhaps there can be a way of designing a expression template so that the values will slot into the template. And then the generate as sql feature can be added to the export feature allowing the export of the entire query, and not just selected parts. These 2 features seem like they overlap. One should be able to select which rows/columns to take out or select all of them.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
CMCDragonkaicommented, Feb 9, 2017

Well imagine if we had sql templates for the current generate sql feature:

DELETE FROM ${database}.${table}
WHERE ${col}=${val};
INSERT INTO ${database}.${table} ${cols}
VALUES ${vals};

Then we could create our own queries beyond the current 3 supported in generate sql, and the 1 supported in export results. We could create a REPLACE version as well. Note that the export results currently only has INSERT as the command prefix.

We may need to consider different substitution variables depending on what kind of command we’re doing. One idea might be ${col:id} = ${val:id} to mean the id named columns and the corresponding value. Or ${pricol} = ${prival} to give special precedence to the primary column.

Any body else got selector syntax ideas?

0reactions
LonwoLonwocommented, Oct 29, 2020

REPLACE INTO into list of INSERT expressions added

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create and customize SQL Server Templates
SQL Server Templates are SQL scripts, containing SQL code, ... To create a SQL template, navigate to the desired folder in the Template...
Read more >
Advanced SQL Templates In Python with JinjaSql
To generate SQL from JinjaSql templates, We'll use the ... To generate a generic query that works with any number of dimensions, ...
Read more >
Generate Scripts (SQL Server Management Studio)
Learn how to use the Generate and Publish Scripts Wizard to create Transact-SQL scripts for multiple objects, and how to use the Script...
Read more >
Configure the SQL code style | IntelliJ IDEA Documentation
Create a code style for a dialect. Open settings by pressing Ctrl+Alt+S and navigate to Editor | Code Style | SQL. Expand the...
Read more >
Creating SQL query templates - Documentation - Data.world
Creating SQL query templates. Audience: Community; Enterprise. The steps in this section are explained using a sample dataset and query.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found