tiny thing
This commit is contained in:
1 parent
19d28994a2
commit
35fc621883
2 files changed
+19
-21
No files matched your search
+9
-11
@@ -106,7 +106,7 @@ def better_connection_actuallyworking(connectionSettings: dict, conn_name="conn"
|
||||
|
||||
# i have to use my own tech
|
||||
@better_connection_actuallyworking(connectionSettings)
|
||||
def fetchonce_lda(
|
||||
def query_once_fetch_lda(
|
||||
execute_settings: tuple,
|
||||
cursor_settings: dict,
|
||||
fetch_many: Literal["one", "many", "all", "warnings"] = "one",
|
||||
@@ -114,7 +114,7 @@ def fetchonce_lda(
|
||||
conn=None,
|
||||
):
|
||||
"every thing passes to execute, return fetchone. lda test"
|
||||
print("i seqeralr", conn)
|
||||
# print("i seqeralr", conn)
|
||||
with conn.cursor(**cursor_settings) as r:
|
||||
r.execute(*execute_settings)
|
||||
match fetch_many:
|
||||
@@ -159,7 +159,7 @@ def fulltable(
|
||||
ifdict = returnType == "dict"
|
||||
try:
|
||||
|
||||
r = fetchonce_lda(
|
||||
r = query_once_fetch_lda(
|
||||
(f"select * from {tableName}",),
|
||||
{"dictionary": ifdict, "prepared": True},
|
||||
fetch_many="all",
|
||||
@@ -186,7 +186,7 @@ def getColumename(
|
||||
) -> list[str]:
|
||||
print(tbaleName)
|
||||
try:
|
||||
coln = fetchonce_lda(
|
||||
coln = query_once_fetch_lda(
|
||||
execute_settings=(
|
||||
"select column_name from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = ?",
|
||||
(tbaleName,),
|
||||
@@ -214,7 +214,7 @@ def getTableNmaes(
|
||||
# ] = None,
|
||||
) -> list[str]:
|
||||
try:
|
||||
coln = fetchonce_lda(
|
||||
coln = query_once_fetch_lda(
|
||||
execute_settings=(
|
||||
"select table_name from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = ?",
|
||||
(db_name,),
|
||||
@@ -257,7 +257,7 @@ def ifTableInDB(
|
||||
|
||||
if (vari := ifTableInDB(dbname, tablename)):"""
|
||||
try:
|
||||
r = fetchonce_lda(
|
||||
r = query_once_fetch_lda(
|
||||
(
|
||||
"select table_name from information_schema.tables where table_schema = ? and table_name = ? Limit 1;",
|
||||
(db_name, tabN),
|
||||
@@ -467,9 +467,7 @@ def post_endp_lda(self):
|
||||
|
||||
updated_Verybreakablequery_insert_into = (
|
||||
f"insert into {tabletbale} "
|
||||
+ "({0}) values ({0})".format( ## LEARN PYTHON SQL this is nasty
|
||||
",".join(("{}",) * len(wwwww)) # incredibly real update
|
||||
).format(*wwwww, *("?",) * len(wwwww))
|
||||
f"({','.join(wwwww)}) values ({','.join('?' for _ in wwwww)})"
|
||||
)
|
||||
print(
|
||||
wwwww,
|
||||
@@ -526,7 +524,7 @@ def openFileManually(
|
||||
theGuy.header_setup(rescode.NOT_FOUND)
|
||||
theGuy.wfile.write(notfound404)
|
||||
return
|
||||
elif path.is_dir():
|
||||
if path.is_dir():
|
||||
path /= defaultFile
|
||||
if not path.is_file():
|
||||
theGuy.header_setup(rescode.NOT_FOUND)
|
||||
@@ -609,7 +607,7 @@ def openFileSemiAutomatically(
|
||||
|
||||
|
||||
def get_from_db(self, pathObj):
|
||||
ee = fetchonce_lda(
|
||||
ee = query_once_fetch_lda(
|
||||
execute_settings=(
|
||||
f"select neme, kewod, cod from {tabletbale} where neme = ?;",
|
||||
(self.path.lstrip("/"),),
|
||||
|
||||
@@ -105,7 +105,7 @@ def unpack_with_defaults(t, defaults=(None, (), {})):
|
||||
# for i in test_subject:
|
||||
# print( f"{i = },\n{unpack_with_defaults(i) = },\n{maybe_safer_unpack(i) = }\n")
|
||||
|
||||
|
||||
# no dont touch this ever
|
||||
def function_splitter(
|
||||
t: tuple[Union[Callable, str], tuple[Any, ...], Dict[str, Any]] = (
|
||||
None,
|
||||
@@ -203,11 +203,11 @@ def funny_trycatch_wrapper(
|
||||
for oneThing in elses:
|
||||
res = function_splitter(oneThing)
|
||||
superreturn["relses"].append(res)
|
||||
finally:
|
||||
for oneThing in finallies:
|
||||
res = function_splitter(oneThing)
|
||||
superreturn["rfinallies"].append(res)
|
||||
return superreturn # lmao
|
||||
# finally:
|
||||
for oneThing in finallies:
|
||||
res = function_splitter(oneThing)
|
||||
superreturn["rfinallies"].append(res)
|
||||
return superreturn # lmao
|
||||
|
||||
|
||||
# thisone = "this string"
|
||||
@@ -239,8 +239,8 @@ def funny_singular_Simple_trycatch(Onetry: tuple):
|
||||
this = function_splitter(Onetry)
|
||||
except BaseException as e:
|
||||
er = e
|
||||
finally:
|
||||
return (this, er)
|
||||
# finally:
|
||||
return (this, er)
|
||||
|
||||
|
||||
def process_datetime_tuples(
|
||||
@@ -312,7 +312,7 @@ def funny_tuples_to_dicts_processor(colname: list[tuple], coldata: list[tuple]):
|
||||
return new_dicts
|
||||
|
||||
|
||||
getnewdictl = lambda d, l: {k: d[k] for k in d if k in l}
|
||||
# getnewdictl = lambda d, l: {k: d[k] for k in d if k in l}
|
||||
|
||||
|
||||
def getnewdict(d: dict, l: list) -> dict:
|
||||
@@ -322,7 +322,7 @@ def getnewdict(d: dict, l: list) -> dict:
|
||||
return {k: d[k] for k in d if k in l}
|
||||
|
||||
|
||||
getnewdicttranslatel = lambda d, tltb: {tltb[k]: d[k] for k in d if k in tltb}
|
||||
# getnewdicttranslatel = lambda d, tltb: {tltb[k]: d[k] for k in d if k in tltb}
|
||||
|
||||
|
||||
def getnewdicttranslate(d: dict, tltb: dict) -> dict:
|
||||
|
||||
Reference in new issue
Block a user