dmddl 0.2.3__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dmddl-0.2.5/PKG-INFO +35 -0
- dmddl-0.2.5/README.md +19 -0
- {dmddl-0.2.3 → dmddl-0.2.5}/pyproject.toml +2 -2
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/cli.py +32 -28
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/config/settings.py +1 -1
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/models/llm.py +7 -1
- dmddl-0.2.3/PKG-INFO +0 -18
- dmddl-0.2.3/README.md +0 -2
- dmddl-0.2.3/src/dmddl/.ruff_cache/.gitignore +0 -2
- dmddl-0.2.3/src/dmddl/.ruff_cache/0.11.9/1354378795363258161 +0 -0
- dmddl-0.2.3/src/dmddl/.ruff_cache/CACHEDIR.TAG +0 -1
- dmddl-0.2.3/src/dmddl/config/.env +0 -2
- {dmddl-0.2.3 → dmddl-0.2.5}/LICENSE +0 -0
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/__init__.py +0 -0
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/config/__init__.py +0 -0
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/models/__init__.py +0 -0
- {dmddl-0.2.3 → dmddl-0.2.5}/src/dmddl/models/prompt.py +0 -0
dmddl-0.2.5/PKG-INFO
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: dmddl
|
3
|
+
Version: 0.2.5
|
4
|
+
Summary: cli tool for creating insert script from ddl script
|
5
|
+
License: MIT
|
6
|
+
Author: HoJLter
|
7
|
+
Author-email: hojlter.work@gmail.com
|
8
|
+
Requires-Python: >=3.13
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
11
|
+
Classifier: Programming Language :: Python :: 3.13
|
12
|
+
Requires-Dist: pydantic (>=2.11.4,<3.0.0)
|
13
|
+
Requires-Dist: pydantic-settings (>=2.9.1,<3.0.0)
|
14
|
+
Description-Content-Type: text/markdown
|
15
|
+
|
16
|
+
|
17
|
+
<h1 align="center">
|
18
|
+
<span style="color:#FFA566">⚙️DM</span>DD<span style="color:#FFA566">L⚙️</span>
|
19
|
+
</h1>
|
20
|
+
<div align="center">
|
21
|
+
<a href = "https://opensource.org/licenses/MIT">
|
22
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg">
|
23
|
+
</a>
|
24
|
+
</div>
|
25
|
+
<img src=".github/dmddl%20logo_3.png" align="center">
|
26
|
+
|
27
|
+
<h3 align="center">
|
28
|
+
CLI app that generates insertion script from DDL
|
29
|
+
</h3>
|
30
|
+
|
31
|
+
---
|
32
|
+
<h2>
|
33
|
+
🖥 Installation
|
34
|
+
</h2>
|
35
|
+
|
dmddl-0.2.5/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
<h1 align="center">
|
3
|
+
<span style="color:#FFA566">⚙️DM</span>DD<span style="color:#FFA566">L⚙️</span>
|
4
|
+
</h1>
|
5
|
+
<div align="center">
|
6
|
+
<a href = "https://opensource.org/licenses/MIT">
|
7
|
+
<img src="https://img.shields.io/badge/License-MIT-yellow.svg">
|
8
|
+
</a>
|
9
|
+
</div>
|
10
|
+
<img src=".github/dmddl%20logo_3.png" align="center">
|
11
|
+
|
12
|
+
<h3 align="center">
|
13
|
+
CLI app that generates insertion script from DDL
|
14
|
+
</h3>
|
15
|
+
|
16
|
+
---
|
17
|
+
<h2>
|
18
|
+
🖥 Installation
|
19
|
+
</h2>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[project]
|
2
2
|
name = "dmddl"
|
3
|
-
version = "0.2.
|
4
|
-
description = "cli tool for creating insert
|
3
|
+
version = "0.2.5"
|
4
|
+
description = "cli tool for creating insert script from ddl script"
|
5
5
|
authors = [
|
6
6
|
{name = "HoJLter",email = "hojlter.work@gmail.com"}
|
7
7
|
]
|
@@ -1,38 +1,31 @@
|
|
1
1
|
import questionary
|
2
|
-
from
|
2
|
+
from config.settings import LLMSettings
|
3
3
|
from rich import print
|
4
4
|
from rich.syntax import Syntax
|
5
5
|
from rich.console import Console
|
6
|
-
from
|
7
|
-
from
|
6
|
+
from models.llm import openai_request
|
7
|
+
from models.prompt import prompt as base_prompt
|
8
8
|
import argparse
|
9
|
-
import sys
|
10
9
|
|
11
10
|
|
12
11
|
AVAILABLE_PROVIDERS = ["OpenAI"]
|
13
|
-
sys.tracebacklimit = 10 # it makes errors more user-friendly (turn off for dev)
|
14
12
|
|
15
13
|
|
16
14
|
def choose_provider(providers):
|
17
|
-
|
15
|
+
provider = questionary.select("Choose your LLM provider:",
|
18
16
|
choices=providers).ask()
|
19
|
-
|
17
|
+
if provider:
|
18
|
+
return provider
|
19
|
+
else:
|
20
|
+
raise Exception("LLM Provider isn't found")
|
20
21
|
|
21
22
|
|
22
23
|
def ask_api_key():
|
23
24
|
api_key = questionary.password("Enter your api key:").ask()
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
console = Console()
|
29
|
-
with console.status("[bold blue]Making test query"):
|
30
|
-
if provider == "OpenAI":
|
31
|
-
try:
|
32
|
-
response = openai_request("Hello! Its a test query :)", api_key)
|
33
|
-
print(f"\n[green bold]{response} \nAll done! Your api key is correct!")
|
34
|
-
except KeyError:
|
35
|
-
print("Your api key is incorrect! Use -c (--config) to set another api key")
|
25
|
+
if api_key:
|
26
|
+
return api_key
|
27
|
+
else:
|
28
|
+
raise Exception("API key isn't provided")
|
36
29
|
|
37
30
|
|
38
31
|
def make_query(provider, api_key, prompt):
|
@@ -41,7 +34,8 @@ def make_query(provider, api_key, prompt):
|
|
41
34
|
if provider == "OpenAI":
|
42
35
|
response = openai_request(base_prompt+prompt, api_key)
|
43
36
|
return response
|
44
|
-
|
37
|
+
|
38
|
+
raise Exception("LLM Provider not found")
|
45
39
|
|
46
40
|
|
47
41
|
def write_output_file(data):
|
@@ -75,25 +69,35 @@ def main():
|
|
75
69
|
llm_provider = settings['DMDDL_CUR_PROVIDER']
|
76
70
|
api_key = settings['DMDDL_LLM_KEY']
|
77
71
|
|
78
|
-
if not api_key or args.config:
|
79
|
-
set_parameters()
|
80
72
|
|
73
|
+
if not args.source and not args.config:
|
74
|
+
print("[red bold]You must provide any arguments:\n"
|
75
|
+
"-c (--config): opens settings menu\n"
|
76
|
+
"-s (--source): specify the input file")
|
77
|
+
|
78
|
+
|
79
|
+
if args.config:
|
80
|
+
set_parameters()
|
81
81
|
if args.source:
|
82
82
|
with open(args.source, "r", encoding='utf-8') as file:
|
83
83
|
user_prompt = file.read()
|
84
84
|
syntax = Syntax(user_prompt, 'sql', line_numbers=True)
|
85
|
+
print(f"\n[yellow bold]{args.source.upper()}\n", )
|
85
86
|
console.print(syntax)
|
86
|
-
|
87
|
-
confirmation = questionary.confirm("Do you wanna use this DDL script?").ask()
|
87
|
+
confirmation = questionary.confirm("Do you want to use this DDL script to generate the insert?").ask()
|
88
88
|
|
89
89
|
if confirmation:
|
90
|
-
response = make_query(provider=llm_provider,
|
91
|
-
|
92
|
-
|
90
|
+
success, response = make_query(provider=llm_provider,
|
91
|
+
api_key=api_key,
|
92
|
+
prompt=user_prompt)
|
93
93
|
write_output_file(response)
|
94
94
|
syntax = Syntax(response, 'sql', line_numbers=True)
|
95
|
+
print("\n\n[yellow bold]OUTPUT.TXT\n",)
|
95
96
|
console.print(syntax)
|
96
|
-
|
97
|
+
if success:
|
98
|
+
print("[green bold] Your DML script is ready! Check output.txt")
|
99
|
+
if not success:
|
100
|
+
print("[red bold] Error has occurred... Check output.txt")
|
97
101
|
|
98
102
|
|
99
103
|
if __name__ == '__main__':
|
@@ -16,6 +16,12 @@ def openai_request(prompt, api_key):
|
|
16
16
|
]
|
17
17
|
}
|
18
18
|
response = requests.post(url=url, headers=headers, json=data)
|
19
|
+
if response.status_code == 200:
|
20
|
+
return True, response.json()['choices'][0]['message']['content']
|
21
|
+
elif response.status_code == 401:
|
22
|
+
return False, ("Your api key is incorrect. \n"
|
23
|
+
"Use -c (--config) to configurate app and set new API key.")
|
24
|
+
else:
|
25
|
+
return False, response.json()['error']['message']
|
19
26
|
|
20
|
-
return response.json()['choices'][0]['message']['content']
|
21
27
|
|
dmddl-0.2.3/PKG-INFO
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.3
|
2
|
-
Name: dmddl
|
3
|
-
Version: 0.2.3
|
4
|
-
Summary: cli tool for creating insert export POETRY_PYPI_TOKEN_PYP script from ddl script
|
5
|
-
License: MIT
|
6
|
-
Author: HoJLter
|
7
|
-
Author-email: hojlter.work@gmail.com
|
8
|
-
Requires-Python: >=3.13
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
11
|
-
Classifier: Programming Language :: Python :: 3.13
|
12
|
-
Requires-Dist: pydantic (>=2.11.4,<3.0.0)
|
13
|
-
Requires-Dist: pydantic-settings (>=2.9.1,<3.0.0)
|
14
|
-
Description-Content-Type: text/markdown
|
15
|
-
|
16
|
-
# dmddl
|
17
|
-
cli app that generates dml script from ddl
|
18
|
-
|
dmddl-0.2.3/README.md
DELETED
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
Signature: 8a477f597d28d172789f06886806bc55
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|