Fix for large packet size

This commit is contained in:
Gent Semaj 2024-01-24 13:57:43 -05:00
parent 8b1bd5b1ee
commit 9fd6441606
Signed by untrusted user: ycc
GPG Key ID: 2D76C57BF6BEADC4

View File

@ -141,19 +141,31 @@ def main(conn, xdt_path):
process_xdt_table(cursor, root, table_name, mappings)
conn.commit()
def connect_to_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="mypassword",
database="tabledata"
)
def prep_db():
conn = connect_to_db()
cursor = conn.cursor()
cursor.execute("SET GLOBAL max_allowed_packet=1073741824")
conn.commit()
conn.close()
# %%
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python3 json2xdb.py <path to xdt file>")
sys.exit(1)
xdt_path = sys.argv[1]
conn = mysql.connector.connect(
host="localhost",
user="root",
password="mypassword",
database="tabledata"
)
prep_db()
conn = connect_to_db()
main(conn, xdt_path)
conn.close()
# %%