sql-organizer


Namesql-organizer JSON
Version 1.0.3 PyPI version JSON
download
home_pageNone
SummaryThis is a simple python CLI tool to organize .sql files. This is a useful tool for my work, but I decided to share it as a project example
upload_time2025-07-25 08:33:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseMIT License Copyright (c) 2025 Steven Rudenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords os sql
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ```
  ____   ___  _        ___                        _              
 / ___| / _ \| |      / _ \ _ __ __ _  __ _ _ __ (_)_______ _ __ 
 \___ \| | | | |     | | | | '__/ _` |/ _` | '_ \| |_  / _ \ '__|
  ___) | |_| | |___  | |_| | | | (_| | (_| | | | | |/ /  __/ |   
 |____/ \__\_\_____|  \___/|_|  \__, |\__,_|_| |_|_/___\___|_|   
                                |___/                            

```
By: Steven Rudenko (steven.gucum@gmail.com)

This project is inspired by a problem I had at work where I would get billion seperate `.sql` files to execute one by one and had to manually copy them into a one worksheet. This CLI tool automates this process. It also sorts the files based on chosen strategies (I will introduce more in the future). Ofcourse this tool can be used with any file format, but since this is manly used for my SQL problem - I named it SQL Organizer :D


## Installation

- Windows

```bash
pip install sql-organizer
```

## Examples

Let's say you have a folder `/folder` with a bunch of .sql files (the current directory will be used by default). If you run the following command

```bash
sql-organizer /folder
```

the tool will generate a `target.sql` file with the combined text from all the .sql files in the `/folder` (the search is recursive)

- Specifying file formats

```bash
sql-organizer /folder -e txt -e sql
```

This will find all the files with .txt and .sql formats in the `/folder` folder

- Specifying target path

```bash
sql-organizer /folder -t /my_target.sql
```

this will put the result into the `my_target.sql` file. The command will error if the file already exists by default, if you want to overwrite it put `--overwrite` parameter:

```bash
sql-oragnizer /folder -t /my_target.sql --overwrite
```

- Choose sorting strategies

```bash
sql-organizer /folder -so last_number
```

You can also chain the startegies, the priority is determined by the position, higher to lower priority
Here are all the available strategies for now

| **Stategy**  | **Descrition**                                                                                                                                                         |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| first_number | The ordering is based on the fist number found in the file name. 0 will be used if no number is found<br>Example: `100_SCRIPT_2.sql` -> 100 will be used for sorting   |
| last_number  | The ordering is based on the last number found in the file name. 0 will be used if no number is found<br>Example: `100_SCRIPT_2.sql` -> 2 will be used for sorting     |
| folder       | The name of the last folder will be used for soring. Sorting is done in an alphabetical order<br>Example: `my/folder/100_SCRIPT.sql` -> folder will be used for soring |


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sql-organizer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "os, sql",
    "author": null,
    "author_email": "Steven Rudenko <steven.gucum@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/53/38/245f14ac22a0510c50839a3ab24b28035a6eefcf8ef128aec6b8e0681aba/sql_organizer-1.0.3.tar.gz",
    "platform": null,
    "description": "```\n  ____   ___  _        ___                        _              \n / ___| / _ \\| |      / _ \\ _ __ __ _  __ _ _ __ (_)_______ _ __ \n \\___ \\| | | | |     | | | | '__/ _` |/ _` | '_ \\| |_  / _ \\ '__|\n  ___) | |_| | |___  | |_| | | | (_| | (_| | | | | |/ /  __/ |   \n |____/ \\__\\_\\_____|  \\___/|_|  \\__, |\\__,_|_| |_|_/___\\___|_|   \n                                |___/                            \n\n```\nBy: Steven Rudenko (steven.gucum@gmail.com)\n\nThis project is inspired by a problem I had at work where I would get billion seperate `.sql` files to execute one by one and had to manually copy them into a one worksheet. This CLI tool automates this process. It also sorts the files based on chosen strategies (I will introduce more in the future). Ofcourse this tool can be used with any file format, but since this is manly used for my SQL problem - I named it SQL Organizer :D\n\n\n## Installation\n\n- Windows\n\n```bash\npip install sql-organizer\n```\n\n## Examples\n\nLet's say you have a folder `/folder` with a bunch of .sql files (the current directory will be used by default). If you run the following command\n\n```bash\nsql-organizer /folder\n```\n\nthe tool will generate a `target.sql` file with the combined text from all the .sql files in the `/folder` (the search is recursive)\n\n- Specifying file formats\n\n```bash\nsql-organizer /folder -e txt -e sql\n```\n\nThis will find all the files with .txt and .sql formats in the `/folder` folder\n\n- Specifying target path\n\n```bash\nsql-organizer /folder -t /my_target.sql\n```\n\nthis will put the result into the `my_target.sql` file. The command will error if the file already exists by default, if you want to overwrite it put `--overwrite` parameter:\n\n```bash\nsql-oragnizer /folder -t /my_target.sql --overwrite\n```\n\n- Choose sorting strategies\n\n```bash\nsql-organizer /folder -so last_number\n```\n\nYou can also chain the startegies, the priority is determined by the position, higher to lower priority\nHere are all the available strategies for now\n\n| **Stategy**  | **Descrition**                                                                                                                                                         |\n|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| first_number | The ordering is based on the fist number found in the file name. 0 will be used if no number is found<br>Example: `100_SCRIPT_2.sql` -> 100 will be used for sorting   |\n| last_number  | The ordering is based on the last number found in the file name. 0 will be used if no number is found<br>Example: `100_SCRIPT_2.sql` -> 2 will be used for sorting     |\n| folder       | The name of the last folder will be used for soring. Sorting is done in an alphabetical order<br>Example: `my/folder/100_SCRIPT.sql` -> folder will be used for soring |\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 Steven Rudenko  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "This is a simple python CLI tool to organize .sql files. This is a useful tool for my work, but I decided to share it as a project example",
    "version": "1.0.3",
    "project_urls": {
        "Repository": "https://github.com/TheSuperShell/sql-organizer"
    },
    "split_keywords": [
        "os",
        " sql"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8a4a6eb59c220172b1c8c34f436e7ca62b12e25c4a75e3581a1faca2f89b6516",
                "md5": "3d0f3aed7df2c2788bd6b15eccb358e8",
                "sha256": "2204055316c2ce5b2191f8cb67147b99acf816a7ebba345ead73f896972df01d"
            },
            "downloads": -1,
            "filename": "sql_organizer-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d0f3aed7df2c2788bd6b15eccb358e8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 7967,
            "upload_time": "2025-07-25T08:33:57",
            "upload_time_iso_8601": "2025-07-25T08:33:57.582248Z",
            "url": "https://files.pythonhosted.org/packages/8a/4a/6eb59c220172b1c8c34f436e7ca62b12e25c4a75e3581a1faca2f89b6516/sql_organizer-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5338245f14ac22a0510c50839a3ab24b28035a6eefcf8ef128aec6b8e0681aba",
                "md5": "76c80055e6225b4e7e24394f61cfef30",
                "sha256": "cc14da361687ebefa3e69be2d6d941c45eaeee154ecdc1d4a6abc1979bce19c0"
            },
            "downloads": -1,
            "filename": "sql_organizer-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "76c80055e6225b4e7e24394f61cfef30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 36480,
            "upload_time": "2025-07-25T08:33:58",
            "upload_time_iso_8601": "2025-07-25T08:33:58.545583Z",
            "url": "https://files.pythonhosted.org/packages/53/38/245f14ac22a0510c50839a3ab24b28035a6eefcf8ef128aec6b8e0681aba/sql_organizer-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-25 08:33:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TheSuperShell",
    "github_project": "sql-organizer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "sql-organizer"
}
        
Elapsed time: 2.15056s