Commit a4db22e
Import from sql (#105)
* Update documentation links and prerequisites for SchemaX
- Corrected the directory references from `.schematic/` to `.schemax/` in multiple documentation files to ensure consistency with the current project structure.
- Updated the Python version requirement in the prerequisites section to specify Python 3.11 or newer, reflecting the latest compatibility standards.
- Enhanced the clarity of the setup instructions for initializing a new SchemaX project, ensuring users have accurate guidance for project setup.
* Enhance CLI Import Functionality and Documentation
- Introduced the ability to import from SQL DDL files via the CLI, allowing users to parse and diff against the current state or replace it as a new baseline.
- Updated the CLI documentation to reflect the new import command options, including `--from-sql`, `--mode`, and `--dry-run`.
- Enhanced the workflows documentation to include the new SQL file import process, providing clearer guidance for users.
- Added unit tests for the new import functionality to ensure robustness and correct operation.
- Refactored the import command to handle both live Databricks imports and SQL file imports seamlessly, improving user experience and flexibility.
* Enhance CLI Import Documentation and DDL Parsing
- Updated the CLI documentation for the `--from-sql` option to clarify the supported Unity Catalog DDL statements, including `CREATE`, `ALTER`, and `COMMENT ON`, ensuring users understand the order of operations during import.
- Improved the workflows documentation to reflect the new capabilities of parsing DDL files, emphasizing the ability to handle both `CREATE` and `ALTER` statements in the correct sequence.
- Refactored the DDL parser in the Unity provider to utilize immutable instances for schema, table, and view updates, enhancing the overall robustness and clarity of the code.
- Added detailed comments in the DDL parser to explain the handling of comments and alterations, ensuring maintainability and ease of understanding for future developers.
* Refactor CLI and DDL Parser for Improved Readability and Functionality
- Reformatted the CLI option definitions for better clarity and consistency in the `cli.py` file.
- Enhanced the `import_assets.py` file by consolidating print statements for improved readability.
- Updated the `__init__.py` file to correctly export SQL utility functions, ensuring they are accessible for other modules.
- Refactored the DDL parser in `ddl_parser.py` to improve the handling of comments and schema creation, enhancing the robustness of the parsing logic.
- Cleaned up test files to ensure consistent formatting and readability, particularly in `test_ddl_parser.py` and `test_import_command.py`.
- Removed unnecessary imports in `test_sql_utils.py` to streamline the test suite.
* Update packages/vscode-extension/src/webview/components/ImportAssetsPanel.tsx
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update version to 0.2.0 and enhance import functionality
- Bumped version numbers in package.json and pyproject.toml to 0.2.0 for both the Python SDK and VS Code extension.
- Introduced the ability to import from SQL files via the CLI, allowing users to parse and diff against the current state or replace it as a new baseline.
- Added a new "From SQL file" tab in the Import assets modal, enabling users to execute `schemax import --from-sql` without a live Databricks connection.
- Updated documentation to reflect the new import command options and workflows, ensuring users have clear guidance on the new features.
* Enhance DDL Parsing and Testing for Trailing Semicolon Handling
- Updated the DDL parser to strip trailing semicolons from catalog and schema names, ensuring accurate parsing of SQL statements.
- Added unit tests to validate the correct handling of trailing semicolons in `CREATE CATALOG` and `CREATE SCHEMA` commands, addressing previously identified bugs.
- Enhanced the `UnityDDLStateBuilder` to update existing catalogs with comments and tags when created implicitly, improving the robustness of catalog management.
- Improved overall test coverage for DDL parsing functionality, ensuring reliability and correctness in various scenarios.
* fmt
* Enhance Import Functionality and SQL Parsing
- Updated the import functionality in `import_assets.py` to support diff mode with target environments, ensuring that parsed state IDs align with local state to avoid unnecessary drop and recreate operations.
- Introduced catalog mapping updates for environments, allowing for seamless integration of imported assets and improved user experience.
- Enhanced the SQL statement splitting logic in `sql_utils.py` to correctly handle inline comments after semicolons, ensuring accurate parsing of SQL commands.
- Updated the DDL parser documentation to clarify the usage of the dialect parameter, indicating that it is reserved for future use.
- Added unit tests to validate the new behavior of SQL statement parsing, particularly for trailing comments, ensuring robustness in SQL generation and import processes.
- Improved accessibility in the Import Assets Panel by adding ARIA attributes for better screen reader support and user navigation.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 3b478da commit a4db22e
30 files changed
Lines changed: 2613 additions & 132 deletions
File tree
- docs/schemax
- docs
- guide
- reference
- packages
- python-sdk
- src/schemax
- commands
- core
- providers
- base
- unity
- tests
- integration
- unit
- utils
- vscode-extension
- src
- webview
- components
- tests/webview/components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
3 | 17 | | |
4 | 18 | | |
5 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
285 | 301 | | |
286 | 302 | | |
287 | 303 | | |
| |||
298 | 314 | | |
299 | 315 | | |
300 | 316 | | |
301 | | - | |
302 | | - | |
303 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
304 | 322 | | |
305 | 323 | | |
306 | 324 | | |
| |||
311 | 329 | | |
312 | 330 | | |
313 | 331 | | |
314 | | - | |
315 | | - | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
316 | 337 | | |
317 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
318 | 358 | | |
319 | 359 | | |
320 | 360 | | |
| |||
323 | 363 | | |
324 | 364 | | |
325 | 365 | | |
326 | | - | |
327 | | - | |
328 | 366 | | |
329 | 367 | | |
330 | 368 | | |
| |||
0 commit comments