dmddl 0.2.21__py3-none-any.whl → 0.2.23__py3-none-any.whl
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/.ruff_cache/.gitignore +2 -0
- dmddl/.ruff_cache/0.11.9/1354378795363258161 +0 -0
- dmddl/.ruff_cache/CACHEDIR.TAG +1 -0
- dmddl/cli.py +25 -19
- dmddl/config/.env +2 -0
- dmddl/config/proxy.py +26 -12
- dmddl/input.txt +1 -0
- dmddl/models/llm.py +16 -12
- dmddl/output.txt +37 -0
- dmddl/requirements.txt +0 -0
- {dmddl-0.2.21.dist-info → dmddl-0.2.23.dist-info}/METADATA +2 -2
- dmddl-0.2.23.dist-info/RECORD +20 -0
- dmddl-0.2.21.dist-info/RECORD +0 -13
- {dmddl-0.2.21.dist-info → dmddl-0.2.23.dist-info}/LICENSE +0 -0
- {dmddl-0.2.21.dist-info → dmddl-0.2.23.dist-info}/WHEEL +0 -0
- {dmddl-0.2.21.dist-info → dmddl-0.2.23.dist-info}/entry_points.txt +0 -0
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
Signature: 8a477f597d28d172789f06886806bc55
|
dmddl/cli.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
+
from idlelib.help import copy_strip
|
2
3
|
|
3
4
|
import questionary
|
4
5
|
from requests.exceptions import ProxyError
|
@@ -15,6 +16,15 @@ from dmddl.config.proxy import get_valid_proxies
|
|
15
16
|
AVAILABLE_PROVIDERS = ["OpenAI"]
|
16
17
|
|
17
18
|
|
19
|
+
class DMDDLConsole:
|
20
|
+
__instance = None
|
21
|
+
|
22
|
+
def __new__(cls, *args, **kwargs):
|
23
|
+
if cls.__instance is None:
|
24
|
+
cls.__instance = Console()
|
25
|
+
return cls.__instance
|
26
|
+
|
27
|
+
|
18
28
|
def choose_provider(providers):
|
19
29
|
provider = questionary.select("Choose your LLM provider:",
|
20
30
|
choices=providers).ask()
|
@@ -34,15 +44,14 @@ def ask_api_key():
|
|
34
44
|
|
35
45
|
def make_query(provider, api_key, prompt, proxies = None):
|
36
46
|
console = Console()
|
37
|
-
|
38
|
-
if provider:
|
39
|
-
|
40
|
-
|
41
|
-
return response
|
47
|
+
if provider:
|
48
|
+
if provider == "OpenAI":
|
49
|
+
response = openai_request(prompt=base_prompt+prompt, api_key=api_key, proxies=proxies, console=console)
|
50
|
+
return response
|
42
51
|
|
43
|
-
|
44
|
-
|
45
|
-
|
52
|
+
raise Exception("LLM Provider not found")
|
53
|
+
else:
|
54
|
+
raise Exception("Use -c (--config) to configurate app and set LLM provider.")
|
46
55
|
|
47
56
|
|
48
57
|
def write_output_file(data):
|
@@ -128,17 +137,14 @@ def main():
|
|
128
137
|
proxies = None
|
129
138
|
|
130
139
|
if args.proxy:
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
140
|
+
console = Console()
|
141
|
+
try:
|
142
|
+
proxies = asyncio.run(get_valid_proxies(console))
|
143
|
+
print("[green bold]\n\tVALID PROXIES")
|
144
|
+
for proxy in proxies:
|
145
|
+
print(f"[green bold]- {proxy}")
|
146
|
+
except:
|
147
|
+
pass
|
142
148
|
confirmation, user_prompt = input_prompt_dialogue(args)
|
143
149
|
|
144
150
|
if confirmation:
|
dmddl/config/.env
ADDED
dmddl/config/proxy.py
CHANGED
@@ -2,6 +2,8 @@ import asyncio
|
|
2
2
|
from bs4 import BeautifulSoup
|
3
3
|
import aiohttp
|
4
4
|
import requests
|
5
|
+
from rich import print
|
6
|
+
from rich.console import Console
|
5
7
|
|
6
8
|
|
7
9
|
def get_proxy_list():
|
@@ -12,24 +14,36 @@ def get_proxy_list():
|
|
12
14
|
table = soup.find('table')
|
13
15
|
for row in table.tbody.find_all('tr'):
|
14
16
|
cols = row.find_all('td')
|
15
|
-
if cols[4].text == 'elite proxy' and cols[6].text == 'yes':
|
17
|
+
if (cols[4].text == 'elite proxy' or cols[4].text == 'anonymous') and cols[6].text == 'yes':
|
16
18
|
proxies.append(f"http://{cols[0].text}:{cols[1].text}")
|
17
|
-
|
18
19
|
return proxies
|
19
20
|
|
20
21
|
|
21
|
-
async def
|
22
|
+
async def is_valid_proxy(url, proxy, session):
|
22
23
|
try:
|
23
|
-
async with session.get(url, proxy=proxy, timeout=
|
24
|
+
async with session.get(url, proxy=proxy, timeout=5) as response:
|
24
25
|
return proxy
|
25
|
-
|
26
|
-
|
26
|
+
|
27
|
+
except (aiohttp.ClientError, ConnectionResetError, asyncio.TimeoutError):
|
28
|
+
return None
|
27
29
|
|
28
30
|
|
29
|
-
async def get_valid_proxies():
|
31
|
+
async def get_valid_proxies(console: Console):
|
30
32
|
proxies = get_proxy_list()
|
31
|
-
url = "https://
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
url = "https://api.openai.com/v1/chat/completions"
|
34
|
+
valid_proxies = []
|
35
|
+
|
36
|
+
with console.status("[blue bold]Checking proxies...") as status:
|
37
|
+
async with aiohttp.ClientSession() as session:
|
38
|
+
tasks = [is_valid_proxy(url, proxy, session) for proxy in proxies]
|
39
|
+
for i, task in enumerate(asyncio.as_completed(tasks), 1):
|
40
|
+
proxy = await task
|
41
|
+
if proxy:
|
42
|
+
valid_proxies.append(proxy)
|
43
|
+
console.print(f"[green bold]✅ Valid proxy: {proxy}")
|
44
|
+
else:
|
45
|
+
console.print(f"[red bold]❌ Invalid proxy: {proxies[i - 1]}")
|
46
|
+
status.update(f"[blue bold]Checked {i}/{len(proxies)} proxies | Valid: {len(valid_proxies)}")
|
47
|
+
|
48
|
+
return valid_proxies
|
49
|
+
|
dmddl/input.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
test
|
dmddl/models/llm.py
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
+
from http.client import RemoteDisconnected
|
2
|
+
|
1
3
|
import requests
|
4
|
+
from requests.exceptions import ProxyError
|
2
5
|
from rich import print
|
3
6
|
|
4
|
-
def openai_request(prompt, api_key, proxies = None):
|
7
|
+
def openai_request(prompt, api_key, console, proxies = None):
|
5
8
|
headers = {
|
6
9
|
"Authorization": f"Bearer {api_key}",
|
7
10
|
"Content-Type": "application/json"
|
@@ -18,17 +21,18 @@ def openai_request(prompt, api_key, proxies = None):
|
|
18
21
|
}
|
19
22
|
|
20
23
|
if proxies:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
with console.status("[bold blue]Making query. Wait for result..."):
|
25
|
+
for proxy in proxies:
|
26
|
+
try:
|
27
|
+
req_proxies = {
|
28
|
+
"https": proxy
|
29
|
+
}
|
30
|
+
print(f"[blue bold]Using proxy: {proxy}")
|
31
|
+
response = requests.post(url=url, headers=headers, json=data, proxies = req_proxies)
|
32
|
+
if response.status_code == 200:
|
33
|
+
break
|
34
|
+
except:
|
35
|
+
print(f"\n[red bold]Proxy error... Trying next proxy")
|
32
36
|
|
33
37
|
else:
|
34
38
|
response = requests.post(url=url, headers=headers, json=data)
|
dmddl/output.txt
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
-- TABLE: users (15 records)
|
2
|
+
INSERT INTO users (user_id, username, email) VALUES
|
3
|
+
(1, 'alice_johnson', 'alice.johnson@example.com'),
|
4
|
+
(2, 'bob_smith', 'bob.smith@example.com'),
|
5
|
+
(3, 'charlie_brown', 'charlie.brown@example.com'),
|
6
|
+
(4, 'diane_green', 'diane.green@example.com'),
|
7
|
+
(5, 'edward_white', 'edward.white@example.com'),
|
8
|
+
(6, 'frank_black', 'frank.black@example.com'),
|
9
|
+
(7, 'grace_kelly', 'grace.kelly@example.com'),
|
10
|
+
(8, 'henry_ford', 'henry.ford@example.com'),
|
11
|
+
(9, 'iris_davis', 'iris.davis@example.com'),
|
12
|
+
(10, 'jack_martin', 'jack.martin@example.com'),
|
13
|
+
(11, 'karen_williams', 'karen.williams@example.com'),
|
14
|
+
(12, 'louis_james', 'louis.james@example.com'),
|
15
|
+
(13, 'maria_anderson', 'maria.anderson@example.com'),
|
16
|
+
(14, 'nancy_thomas', 'nancy.thomas@example.com'),
|
17
|
+
(15, 'oscar_harrison', 'oscar.harrison@example.com');
|
18
|
+
|
19
|
+
-- TABLE: orders (15 records)
|
20
|
+
INSERT INTO orders (order_id, user_id, order_date) VALUES
|
21
|
+
(1, 1, '2023-03-01'),
|
22
|
+
(2, 2, '2023-03-02'),
|
23
|
+
(3, 3, '2023-03-03'),
|
24
|
+
(4, 4, '2023-03-04'),
|
25
|
+
(5, 5, '2023-03-05'),
|
26
|
+
(6, 6, '2023-03-06'),
|
27
|
+
(7, 7, '2023-03-07'),
|
28
|
+
(8, 8, '2023-03-08'),
|
29
|
+
(9, 9, '2023-03-09'),
|
30
|
+
(10, 10, '2023-03-10'),
|
31
|
+
(11, 11, '2023-03-11'),
|
32
|
+
(12, 12, '2023-03-12'),
|
33
|
+
(13, 13, '2023-03-13'),
|
34
|
+
(14, 14, '2023-03-14'),
|
35
|
+
(15, 15, '2023-03-15');
|
36
|
+
|
37
|
+
-- WARNING: Ensure user_id in orders exists in users.
|
dmddl/requirements.txt
ADDED
Binary file
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: dmddl
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.23
|
4
4
|
Summary: cli tool for creating insert script from ddl script
|
5
5
|
License: MIT
|
6
6
|
Author: HoJLter
|
@@ -29,7 +29,7 @@ Description-Content-Type: text/markdown
|
|
29
29
|
<img src=".github/dmddl%20logo_4.png" align="center">
|
30
30
|
|
31
31
|
<h3 align="center">
|
32
|
-
CLI
|
32
|
+
CLI tool that generates insertion script from DDL
|
33
33
|
</h3>
|
34
34
|
|
35
35
|
---
|
@@ -0,0 +1,20 @@
|
|
1
|
+
dmddl/.ruff_cache/.gitignore,sha256=njpg8ebsSuYCFcEdVLFxOSdF7CXp3e1DPVvZITY68xY,35
|
2
|
+
dmddl/.ruff_cache/0.11.9/1354378795363258161,sha256=L3hDS6FRTSJLyZSY-GZ75mpl9wiuFnMN9ESaojdTGoM,465
|
3
|
+
dmddl/.ruff_cache/CACHEDIR.TAG,sha256=WVMVbX4MVkpCclExbq8m-IcOZIOuIZf5FrYw5Pk-Ma4,43
|
4
|
+
dmddl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
dmddl/cli.py,sha256=bmr0FphkRDGJOhW2KX85WGMcAPiczaDfe5Dqu0m9nek,4531
|
6
|
+
dmddl/config/.env,sha256=ViORk1v0SOwLiZUBUOsWZUXgHnsJe67qXq7cklz9Z_4,211
|
7
|
+
dmddl/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
dmddl/config/proxy.py,sha256=-6DfuggcXwDjtx8jbOMHy370AvM_t3kYc67q68CCqRM,1763
|
9
|
+
dmddl/config/settings.py,sha256=2xRMW9sjc3aro2QUGLMhKQGdAuCMkc5n6G23iXrkyMo,1261
|
10
|
+
dmddl/input.txt,sha256=n4bQgYhMfWWaL-qgxVrQFaO_TxsrC4Is0V1sFbDwCgg,4
|
11
|
+
dmddl/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
dmddl/models/llm.py,sha256=QvVspWqb4bthrbn39gMPmCp_1DxHaI7IPVD1-PjgNiM,1622
|
13
|
+
dmddl/models/prompt.py,sha256=7cjWC-mQJR32jc0a0GsyoYDZWROB57Yk4Wy4nRsiFoM,1923
|
14
|
+
dmddl/output.txt,sha256=oVtNzMeEcoJ3UUtsiyugFB9s3mYLt0UyuEs5ppXb-WY,1337
|
15
|
+
dmddl/requirements.txt,sha256=aPA3NBpypHOiXAK9MwfzIDhPIKxtB71s4yCeAXvbs1k,2046
|
16
|
+
dmddl-0.2.23.dist-info/entry_points.txt,sha256=87tyUAFcB9RYRLhYyxroZxcTho-o3IGXnMM4uMGKdV4,40
|
17
|
+
dmddl-0.2.23.dist-info/LICENSE,sha256=C--Tlk2EXyLEz1DSTQFKOo-WblCPTsxPcd8t63NCauw,1090
|
18
|
+
dmddl-0.2.23.dist-info/METADATA,sha256=vU_dQAqflU1zPbei7PD-rzKdJxIccmbA8Rv-k4I3OI0,1779
|
19
|
+
dmddl-0.2.23.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
20
|
+
dmddl-0.2.23.dist-info/RECORD,,
|
dmddl-0.2.21.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
dmddl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
dmddl/cli.py,sha256=JIeUb8tVeHNGvnSQH77EXhWVGwvh1H1UotAWHv3-FQI,4522
|
3
|
-
dmddl/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
dmddl/config/proxy.py,sha256=SSMviuSlJ9l8C_-nT2vcxKEWUBJoaAweszVehzwDYUU,1063
|
5
|
-
dmddl/config/settings.py,sha256=2xRMW9sjc3aro2QUGLMhKQGdAuCMkc5n6G23iXrkyMo,1261
|
6
|
-
dmddl/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
dmddl/models/llm.py,sha256=ruW57MEwscWtCWe6MvfGP0FGvuRJlVWM12c-W0IS1_c,1354
|
8
|
-
dmddl/models/prompt.py,sha256=7cjWC-mQJR32jc0a0GsyoYDZWROB57Yk4Wy4nRsiFoM,1923
|
9
|
-
dmddl-0.2.21.dist-info/entry_points.txt,sha256=87tyUAFcB9RYRLhYyxroZxcTho-o3IGXnMM4uMGKdV4,40
|
10
|
-
dmddl-0.2.21.dist-info/LICENSE,sha256=C--Tlk2EXyLEz1DSTQFKOo-WblCPTsxPcd8t63NCauw,1090
|
11
|
-
dmddl-0.2.21.dist-info/METADATA,sha256=wm_Dq87MK7gprWpC62Up_ZcKYZanYni-Ue-o3jtE0-4,1778
|
12
|
-
dmddl-0.2.21.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
13
|
-
dmddl-0.2.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|