-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Substitution 'node-sql-parser' with a forked version until April 1st (Next Release) #597
Conversation
…ort-extra-ddl-statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see to update accepted with few code changes necessary. I left some comments to remove testing changes. Seeing as we have another issue related to partitions, can you open an issue in node-sql-parser to support CREATE TABLE access_keys_hash_p0 PARTITION OF access_keys FOR VALUES WITH (modulus 10, remainder 0);
? Hopefully, the author can put support for that in before the march release.
I would say neither of the suggested Runner approaches are ones we would want to work with. Trying to isolate create table statements is hard because more things than just create table impact type gen. Case in point CREATE TYPE. We also have alter table. And anything which sets restrictions on columns or primary keys. And probably many more. We expose ourselves to more edge cases. In that, that was my initial approach to case sensitive columns before scrapping it in favor of asking the author to just support quotes. It involves messing around with regex A LOT which is just a whole can of worms we'd like to avoid when possible. Especially against human generated strings like the schema.
Speaking of quotes, I believe that's the next low hanging fruit here before you fully drive on logs table epic.
I noticed you went ahead with letting the code default the any type for the created types. As I mentioned earlier, this is fine for now. Perhaps in the future we can support some commonly used types like enum.
Oh one other thing, can you rename the PR? It's very amgibuous as it is. It doesn't communicate what is being migrated. And it also doesn't explain that we're substituting a package in the short term. It should be more like I'd also clean up the PR description (Which becomes the commit message). It's super wordy, which won't help whoever might reads this in the future. The PR description should describe what changes you made, why they were necessary (The issue being solved), and any tech debt incurred or planned future actions relevant to the changes. In this case, substituting the package, testing to ensure some particular schema/sql is supported, explaining what isn't supported still (Partition) and any planned work related to the fix (partition support, leveraging quote data in AST for case sensitive schema support). |
Frontend Changes:Changing our version of node-sql-parser from 4.10 -> 4.18.1 (kevin-node-sql-parser) resulted in the library generating a more verbose AST. As a result, our types generation stopped working. This video showcases successful type generation after migrating to the latest version using kevin-node-sql-parser for a basic ddl. https://www.loom.com/share/63a05346c08c409387c6c3571c8a67d9 Changes to the AS after bumping versions using a diffchecker However when trying a more complex ddl. The parser supports and respects Types but does not respect partitions syntax and throws an error when attempting to astify. Runner Changes:Runner uses node-sql-parser in the index.ts file. When substituting node-sql-parser for kevin-node-sql-parser to runner which is the next upgrade when node-sql-parser is updated (expect end of this March), buildDatabaseContext will succeed for basic examples but for more complex DDL statements they fail for tables with an expected error message of the following:
After a briefly tracking the error, the error occurs in getTableNames specifically in the astify line. Provided with this SQL below
Due to the ticket here. node-sql-parser does yet not support full declarative partitions. ex: As a result, The behavior of the sql above (Note the line PARTITION BY HASH (public_key)) will be using the table inheritance where it doesn't create separate physical tables for each partition; instead, it distributes data within the main table based on the hash value of the specified column. compared to
In these statements there are physical creations of tables Currently: The parser's astify does not support the Partition by Hash (see additional ticket link above). For FE: For Runner:
SUMMARY
Next Steps for Runner:
In General:
|
Nice job with the changes to the PR Description. It's a good step in the right direction. You don't need to make it that formal either. Just consider that if someone new to the team had to look at this PR for whatever reason with little context. Write the description to, at a glance, describe what the PR does and the decision making going into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved conflicts
- feat: Instrument Runner Service (#602) - Support WHERE col IN (...) in context.db.table.select and delete (#606) - feat: Include indexer name in context db build failure warning (#611) - Cache provisioning status (#607) - Fix ESLint on DmlHandler (#612) - fix: Substitution 'node-sql-parser' with a forked version until Apri 1st (#597) - feat: Add pgBouncer to QueryApi (#615) - feat: Expose near-lake-primitives to VM (#613) --------- Co-authored-by: Pavel Kudinov <[email protected]> Co-authored-by: Pavel Kudinov <[email protected]> Co-authored-by: Kevin Zhang <[email protected]> Co-authored-by: Morgan McCauley <[email protected]>
A temporary change in our codebase. Replacing the usage of node-sql-parser with kevin-node-sql-parser until April 1st. The reason for this substitution is that the official release of node-sql-parser lacks a version release for the additional SQL statements required for our current project needs. In the interim, this forked version addresses these shortcomings and allows us to incorporate the required SQL statements. Please note that this is a temporary measure, and we plan to revert to the official node-sql-parser version after April 1st, once the required features are officially available.
See last comment for details