-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/migrate to ruff #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c271393
feat: migrate to uv and ruff
florian-drouet 10e5985
feat: add uv.lock
florian-drouet 452473c
fix: install uv in github actions workflow
florian-drouet c2e5696
fix: install uv
florian-drouet 071e855
fix: ruff check
florian-drouet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,5 @@ | ||
| env: | ||
| rm -Rf env | ||
| python3 -m venv env | ||
| env/bin/pip install -U pip setuptools | ||
| env/bin/pip install poetry | ||
| source env/bin/activate && python -m poetry install | ||
| uv sync | ||
|
|
||
| black: | ||
| python -m black --line-length 88 tableau_sql_parser/ | ||
| python -m black --line-length 88 tests/ | ||
|
|
||
| isort: | ||
| isort tableau_sql_parser/ | ||
| isort tests/ | ||
|
|
||
| lint: | ||
| flake8 --max-line-length 88 tableau_sql_parser/ | ||
| flake8 --max-line-length 88 tests/ | ||
|
|
||
| format: black isort lint | ||
| format: | ||
| uvx ruff check . --fix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,19 @@ | ||
| # tableau-sql-parser | ||
| SQL parser for Tableau custom SQL requests | ||
|
|
||
| ## Usage | ||
| ## What is it ? | ||
|
|
||
| Given a .twb or a .twbx Tableau archive, you can extract these information: | ||
| Given a .twb or a .twbx Tableau archive, you can extract as a report these information: | ||
| - number of queries analyzed | ||
| - tables used | ||
| - a tree-like structure describing `schema.tables.column` | ||
|
|
||
| The CLI command to use is `sqlparse`: | ||
| ## How to use it ? | ||
|
|
||
| `sqlparse -f file/to/parse.twb(x) -r custom_report_name -o` | ||
| **Requirement** : install [uv](https://github.com/astral-sh/uv) globally (with brew for example) | ||
|
|
||
| Type `sqlparse --help` for more details. | ||
| Then run `uv sync` | ||
| Then download a Tableau archive (.twbx or .twb) | ||
| Then run `uv run sqlparse -f file/to/parse/archive.twb(x) -r custom_report_name -o` to extract the report | ||
|
|
||
| Type `uv run sqlparse --help` for more details. |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,34 @@ | ||
| [tool.poetry] | ||
| [project] | ||
| name = "tableau-sql-parser" | ||
| version = "0.1.1" | ||
| version = "0.1.2" | ||
| description = "A tool for parsing Tableau custom SQL queries and extracting useful information" | ||
| authors = ["florian-drouet <50357200+florian-drouet@users.noreply.github.com>"] | ||
| license = "LICENSE" | ||
| authors = [ | ||
| { name = "Florian Drouet", email = "florian.drouet@gmail.com" } | ||
| ] | ||
| license = { file = "LICENSE" } | ||
| readme = "README.md" | ||
| packages = [{include = "tableau_sql_parser"}] | ||
| requires-python = ">=3.9,<3.11" | ||
| dependencies = [ | ||
| "lxml>=5.4.0", | ||
| "sqlfluff>=3.4.0", | ||
| ] | ||
|
|
||
| [tool.poetry.scripts] | ||
| sqlparse = "tableau_sql_parser.cli:main" | ||
| [tool.uv] | ||
| package = true | ||
|
|
||
| [tool.poetry.dependencies] | ||
| python = "^3.9" | ||
| lxml = "4.9" | ||
| sqlfluff = "2.1" | ||
| [tool.ruff] | ||
| target-version = "py39" | ||
| line-length = 88 | ||
|
|
||
| [tool.poetry.group.dev.dependencies] | ||
| black = "23.7" | ||
| flake8 = "6.0" | ||
| isort = "5.12" | ||
| pytest = "7.4" | ||
|
|
||
| [build-system] | ||
| requires = ["poetry-core"] | ||
| build-backend = "poetry.core.masonry.api" | ||
| lint.select = [ | ||
| "E", "F", "W", # Basic errors and warnings | ||
| "A", # Shadowing builtins | ||
| "B", # flake8-bugbear | ||
| "C4", # flake8-comprehensions | ||
| "I", # isort | ||
| "N", # pep8-naming | ||
| "ANN", # Type annotations | ||
| "UP", # pyupgrade | ||
| "SIM", # Simplify | ||
| "PLC", "PLE", "PLW" # pylint | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,5 +21,5 @@ | |
| """ | ||
|
|
||
|
|
||
| def test__flatten_values(): | ||
| def test__flatten_values() -> None: | ||
| assert tree_output(test_input) == expected | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.