Wrote dumpscript & updated/fixed mysqldump
This commit is contained in:
parent
09e41822c9
commit
90bcf51317
4 changed files with 268 additions and 0 deletions
29
tools/demo_query.py
Normal file
29
tools/demo_query.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# This script needs mysql driver:
|
||||
# pip3 install mysql
|
||||
|
||||
import MySQLdb
|
||||
|
||||
db = MySQLdb.connect(host ="hoschis-tippspiel.de", # your host, usually localhost
|
||||
user ="d0274241", # your username
|
||||
passwd="superpfosten!", # your password
|
||||
db ="d0274241") # name of the data base
|
||||
|
||||
# you must create a Cursor object. It will let
|
||||
# you execute all the queries you need
|
||||
cur = db.cursor()
|
||||
|
||||
# Use all the SQL you like
|
||||
cur.execute("SELECT * FROM seasons")
|
||||
|
||||
# Column namnes
|
||||
arr=[]
|
||||
for i in range(0,len(cur.description)):
|
||||
arr.append(cur.description[i][0])
|
||||
print(";".join(arr))
|
||||
|
||||
for row in cur.fetchall():
|
||||
print (row)
|
||||
print("---")
|
||||
|
||||
|
||||
db.close()
|
||||
12
tools/dump_motorradig.py
Normal file
12
tools/dump_motorradig.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# This script needs mysqldump to be installed
|
||||
# apt install mysql-client
|
||||
|
||||
import os
|
||||
import datetime
|
||||
|
||||
str_now=datetime.datetime.now().strftime('%Y-%m-%d_%H%M%S')
|
||||
|
||||
filename="motorradig_"+str_now+".sql"
|
||||
print("Dumping "+filename)
|
||||
cmd="""mysqldump --no-tablespaces --column-statistics=0 -ud0304938 -phubbabubba -h motorrad-ig.de d0304938 > """+filename
|
||||
os.system(cmd)
|
||||
2
tools/dumpdb
Normal file
2
tools/dumpdb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
echo "Running dump_pfosten.py"
|
||||
python dump_pfosten.py
|
||||
225
tools/motorradig_2022-04-04_130750.sql
Normal file
225
tools/motorradig_2022-04-04_130750.sql
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue