Retrieve compiled SQL query
See original GitHub issueHello and thanks for this wonderful lib !
On my project, I use AWS S3 Select feature on CSVs stored in S3. It allows executing a SQL-like query directly on those CSVs:
import { S3Client, SelectObjectContentCommand } from '@aws-sdk/client-s3';
const s3Client = new s3Client()
const Response = await s3Client.send(
new SelectObjectContentCommand({
... // some serialization options
ExpressionType: 'SQL',
Expression: `
SELECT ...
FROM S3Object
WHERE ...
`
})
);
I would really like using kysely
to build such queries but for the moment I cannot:
- I haven’t found a way to simply retrieve the compiled SQL query string to provide it to the S3Client
- The
Kysely
class constructor requires adialect
whereas I don’t really need one (other solution is to build an adapter forS3Select
but that’s a whole lotta work)
Would it be possible to make dialect
optional in the constructor (and throw an error if none is found when needed) and expose a compileQuery
method on the db
to retrieve the compiled query ?
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How do I get a raw, compiled SQL query from a SQLAlchemy ...
I have a SQLAlchemy query object and want to get the text of the compiled SQL statement, with all its parameters bound (e.g....
Read more >Get SQL Command Compile time - SQLServerCentral
Get SQL Command Compile time · 1. SET STATISTICS TIME ON · 2. SQL Profiler (or SQL Trace) · a) SQL Batch ·...
Read more >How to find compiled parameter values for SQL Server cached ...
In this tip we look at how to use SSMS and T-SQL to find the parameter values that were used to create the...
Read more >Inside SQL Server: Parse, Compile, and Optimize - ITPro Today
The relational engine parses the submitted statements, optimizes the SQL statements, compiles the code, and manages the query execution. During execution, ...
Read more >Frequent query recompilations - a SQL query performance killer
A compilation is the process when a stored procedure's query execution plan is optimized, based on the current database and database objects ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Normally you should never “hydrate” parameters to the SQL string. That’s a sure way to get your system pwned. For that reason, there’s no built in way to do it.
Hey 👋
You can brew a dialect with existing built-in components and replace the driver with built-in
DummyDriver
.This is documented in the browser example.
Now just use
.compile()
with any of the query builders to getCompiledQuery
instances that containsql
andparameters
fields.