-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
130 lines (104 loc) · 3.53 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# This is a sample Python script.
# Press ⇧F10 to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
# TODO to increase speed and scale up try https://github.com/dask-contrib/dask-sql
# TODO create cpu/gpu switch where it checks if GPU exists then uses dask
from os import environ, path
from dotenv import load_dotenv
import dask
load_dotenv() # take environment variables from .env.
def main():
"""
get users name for db admin priveledges and personalization
:return:
"""
print_hi(user_name=USER_NAME)
which_database()
# gpu_exist_active()
# TODO create menu_generator() function similar to mstables
create_environment()
def print_hi(user_name):
"""
get users name for db admin priveledges and personalization
:param user_name:
:return:
"""
# global user_name
print(f"Hi, {user_name}") # Press ⌘F8 to toggle the breakpoint.
return user_name
def which_database():
"""
Get users preference for database
:return:
"""
POSTGRESQL = "postgress_12"
MYSQL = "mysql_08"
SQLITE3 = "sqlite_03"
SQLSERVER = "sqlserver_17"
ORACLE = "oracle_11"
AWS = "RDS_09"
NOSQL = "salesforce_02"
# TODO use the terms from each database
# TODO print(f'Hi, {user_name} what database do you want to work with?')
# TODO print(f'Do you prefer')
# TODO pull from nvidia for GPU check script
def gpu_exist_active():
"""
checking if a GPU is active
:return:
"""
# SOURE https://dask-sql.readthedocs.io/en/latest/
import dask.datasets
# TODO error ""
print("cuda gpu support available but not installed 'import dask_cudf'")
from dask_sql import Context
# create a context to register tables
c = Context()
# create a table and register it in the context
df = dask.datasets.timeseries()
c.create_table("timeseries", df, gpu=True)
# execute a SQL query; the result is a "lazy" Dask dataframe
result = c.sql(
"""
SELECT
name, SUM(x) as "sum"
FROM
timeseries
GROUP BY
name
"""
)
# actually compute the query...
result.compute()
# ...or use it for another computation
result.sum.mean().compute()
pass
def create_environment():
"""
function to create and populate .env file
"""
# TODO prompt user for database un
# TODO prompt user for database pw
# TODO prompt user for database PATH
# TODO prompt user for database API info (as needed)
# TODO prompt user for database booster like dask, motin
# TODO prompt user for database bloom index if accuracy is vital
# TODO prompt user for database packages, pandas, numpy, matplotlib, seaborn
# TODO prompt user for database POSTGRESQL, SQLITE, MYSQL, SQLSERVER, ORACLE, AWS, NOSQL
print("create_environment function pass")
# Press the green button in the gutter to run the script.
if __name__ == "__main__":
USER_NAME = environ.get("USER_NAME")
confirm_user_name = input(f"Hello your first name is {USER_NAME}?")
# TODO add yes/no option else
# TODO grep day time greetings based on morning, night etc
# TODO prompt user for user name
print_hi("Greetings, PyCharm has run")
# Find .env file
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, ".env"))
# General Config
SECRET_KEY = environ.get("SECRET_KEY")
FLASK_APP = environ.get("FLASK_APP")
FLASK_ENV = environ.get("FLASK_ENV")
main()