Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: pymysql; insert on duplicate key update fails
Post: RE: pymysql; insert on duplicate key update fails
seems mariadb simply does not support this "AS" construct....mysql 8+ only feature |
|
wardancer84 |
General Coding Help |
4 |
1,938 |
Jun-28-2022, 11:47 AM |
|
|
Thread: pymysql; insert on duplicate key update fails
Post: RE: pymysql; insert on duplicate key update fails
(Jun-28-2022, 10:59 AM)rob101 Wrote: It could be nothing, it could be everything, but I don't see a semicolon terminator at the end of the query string, as there is with with the SQL statement on li... |
|
wardancer84 |
General Coding Help |
4 |
1,938 |
Jun-28-2022, 11:28 AM |
|
|
Thread: pymysql; insert on duplicate key update fails
Post: pymysql; insert on duplicate key update fails
i dont want to go to deep here so...i want to do the above stated kind of query with pymysql...
relevant piece of code:
sql = "INSERT INTO entries (node_id, attrib_id, value, unique_id) VALUES (%d... |
|
wardancer84 |
General Coding Help |
4 |
1,938 |
Jun-28-2022, 10:19 AM |
|
|
Thread: set.difference of two list gives empty result
Post: RE: set.difference of two list gives empty result
this diff method can handle duplicates...works well at first sight
from collections import Counter
...
dead_ips = list((Counter(aix_ips) - Counter(aix_reg_list)).elements()) # get list of whats in th... |
|
wardancer84 |
General Coding Help |
4 |
1,434 |
Jun-14-2022, 01:36 PM |
|
|
Thread: set.difference of two list gives empty result
Post: RE: set.difference of two list gives empty result
this list contains 2 more items
items in aix_ips (netbox) list: "1710"than this list
items in aix registry list: "1708"so this 2 items should show up in the difference results IMHO
no sure if this ... |
|
wardancer84 |
General Coding Help |
4 |
1,434 |
Jun-14-2022, 12:51 PM |
|
|
Thread: set.difference of two list gives empty result
Post: set.difference of two list gives empty result
hi,
i want to get the difference from two list of strings (using sets) but i always get an empty result. funny enough this worked until today and stopped working overnight without me changing somethi... |
|
wardancer84 |
General Coding Help |
4 |
1,434 |
Jun-14-2022, 11:05 AM |
|
|
Thread: remove colon if value is None
Post: RE: remove colon if value is None
#!/usr/bin/env python3
import sys
import os
import re
from itertools import chain
import pymysql
import pymysql.cursors
from SudoersLib import *
def string_cleaner(x):
pattern = re.sub(r"[\[{}... |
|
wardancer84 |
General Coding Help |
7 |
1,873 |
Feb-02-2022, 12:32 PM |
|
|
Thread: remove colon if value is None
Post: RE: remove colon if value is None
oh god sorry, i am an idiot...i am concatenating a string together and insert the colon after the extracted tags.
is there some trick to not insert the colon of no tag is present?
for rule in sudo_o... |
|
wardancer84 |
General Coding Help |
7 |
1,873 |
Feb-02-2022, 10:15 AM |
|
|
Thread: remove colon if value is None
Post: RE: remove colon if value is None
(Feb-01-2022, 02:51 PM)ibreeden Wrote: Could you show us an example of the contents of rule["commands"] ? With at least one normal entry and a "None" entry.
[{'run_as': ['ALL'], 'tags': ['NOPASSWD... |
|
wardancer84 |
General Coding Help |
7 |
1,873 |
Feb-01-2022, 06:51 PM |
|
|
Thread: remove colon if value is None
Post: remove colon if value is None
hey,
i have this comprehension...
extracted_tags = [li['tags'] for li in rule["commands"] if li['tags'] is not None]works perfectly, thing is this sometimes (when results is None) leaves a lonesome ... |
|
wardancer84 |
General Coding Help |
7 |
1,873 |
Feb-01-2022, 01:07 PM |
|
|
Thread: pymysql: insert query throws error
Post: RE: pymysql: insert query throws error
ah...very nice, thank you. i will post code here when the prototype is finished, might be usefull for someone. |
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-28-2022, 06:48 AM |
|
|
Thread: pymysql: insert query throws error
Post: RE: pymysql: insert query throws error
(Jan-24-2022, 06:52 PM)ibreeden Wrote: I also tried to understand the sudoers object so I followed your link to python-sudoers but the examples all start with "from pysudoers import Sudoers" while ... |
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-25-2022, 07:52 AM |
|
|
Thread: pymysql: insert query throws error
Post: RE: pymysql: insert query throws error
(Jan-24-2022, 11:55 PM)Pedroski55 Wrote: Are you not overly complicating a simple matter?
might be, the thing is i have sudoers files with an insane linecount above 1000 with all variations/combinat... |
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-25-2022, 07:48 AM |
|
|
Thread: pymysql: insert query throws error
Post: RE: pymysql: insert query throws error
very helpful inputs...thanks for that.
i changed the script according to your suggestions...
#!/usr/bin/env python3
import sys
import os
import pprint
from collections import defaultdict
import py... |
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-24-2022, 02:14 PM |
|
|
Thread: pymysql: insert query throws error
Post: RE: pymysql: insert query throws error
hi,
thanks for answering. you are right, this needs more explaination.
First, i use python-sudoers for parsing sudoers files.
So this is part of the procedure of parsing various aspects of a sudoers... |
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-24-2022, 11:05 AM |
|
|
Thread: pymysql: insert query throws error
Post: RE: pymysql: insert query throws error
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-24-2022, 08:06 AM |
|
|
Thread: pymysql: insert query throws error
Post: pymysql: insert query throws error
hi,
i',m trying to parse sudo files and inserting the results into a mysql table for eaysier analyzing an so on. parsing works well sof far, but pymysql will not let me do the insert.
the script:
#... |
|
wardancer84 |
General Coding Help |
12 |
4,421 |
Jan-21-2022, 12:54 PM |
|
|
Thread: unpacking list
Post: RE: unpacking list
works basically, tried to extend it and for some reason values are getting lost in the append loop...
test script:
#!/usr/bin/env python3
test_data = {"identity": {"HOSTNAME": "kittykat", "AIX_REG_... |
|
wardancer84 |
General Coding Help |
2 |
1,837 |
Sep-11-2021, 02:42 PM |
|
|
Thread: unpacking list
Post: unpacking list
hi,
test script...
#!/usr/bin/env python3
#test_lst = [('IP', '172.17.10.147'), ('IP', '172.16.88.57'), ('IP', '172.16.12.147')]
test_data = {"identity": {"HOSTNAME": "sag01147", "AIX_REG_CLIENT_VE... |
|
wardancer84 |
General Coding Help |
2 |
1,837 |
Sep-10-2021, 02:08 PM |
|
|
Thread: changing key names in nested dict
Post: RE: changing key names in nested dict
ok got it...thank you for pushing me in the right direction **cool** i do this for self educational purposes to make me
a little bit mor python fluent, so sorry for some potential stupid questions.... |
|
wardancer84 |
General Coding Help |
6 |
2,095 |
Sep-10-2021, 08:13 AM |