Guten Morgen,
ich komme hier grade nicht weiter und hoffe ihr könnt mir helfen:
Mein Problem ist das ich gerne meine results ordentlich strukturiert in eine CSV übertragen möchte.
Wie ihr seht ist das ein ganzer Batzen und diesen gilt es jetzt zu speichern um in meine Verfahrens-Dokumentation einzufließen.
Mir fehlt leider der Ansatz dazu. Hoffe ihr habt eine Idee denn ich finde dazu leider nichts passendes. Wäre über jeden rat dankbar.
Ihr seid die besten!
CODE:
import mysql.connector
cnx = mysql.connector.connect(host='127.0.0.1', database='amadeus_7875',user='external', password='to******l..1983*', port=1302)
mycursor = cnx.cursor()
sql = "SELECT * FROM waiterroles Where name = 'Chef'"
mycursor.execute(sql)
myresult = mycursor.fetchone()
for x in myresult:
print(x)
RESULT:
C:\Users\kasse\PycharmProjects\bitcoin\venv\Scripts\python.exe C:/Users/kasse/PycharmProjects/phantasie/mysqlabfrage.py
1
32
-7875
Y
1
Chef
CANCEL_IMMEDIATE,NONE,Y\nCANCEL_LINE,NONE,Y\nCANCEL_SLIP,NONE,Y\nCORRECT_TABLE,NONE,Y\nCANCELLATIONREASON,NONE,N\nCANCEL_TABLE,NONE,Y\nCANCELLATION_GENERAL,NONE,N\nCANCELLATION_SUBSEQUENT,NONE,N\nCANCELLATION_DOCUMENTS,NONE,Y\nUSE_TEMPORARY_CANCELLATION,NONE,N\nCLEAR_TEMPORARY_CANCELLATION,NONE,N\nCANCEL_PAYMENTS,NONE,Y\nMOVE_ARTICLE_TABLE,NONE,Y\nSEPARATE_ARTICLE_TABLE,NONE,N\nMAX_LOGINS,NONE,\nTEMPORARY_LOGOFF,NONE,Y\nPERMANENT_LOGOFF,NONE,N\nREQUEST_TAN_OWN,NONE,N\nREQUEST_TAN_OTHER,NONE,N\nREQUEST_TAN_TERMINAL,NONE,N\nCHANGE_WAITER,NONE,Y\nCHANGE_WAITER_AFTER_SERVICEEND,NONE,N\nRESET_SERVICE_END,NONE,N\nSTARTRECORD_WITH_FUNCTION,NONE,N\nXREPORT_OPENTABLE,NONE,Y\nWAITER_CHANGEMONEY,NONE,N\nLOGON_REPORT,NONE,FUNC10\nLOGOFF_REPORT,NONE,FUNC10\nCHANGE_PROFILE,NONE,Y\nCHANGE_PRICELEVEL,NONE,Y\nCHANGE_SITE,NONE,Y\nZERO_PRICE_PLU,NONE,Y\nOPEN_PRICE_PLU,NONE,Y\nSTAR_TABLE,NONE,Y\nCOMMA_TABLE,NONE,Y\nZERO_TABLE,NONE,N\nPLU_ALLOWED,NONE,Y\nPAYMENT_ALLOWED,NONE,Y\nTABLE_INPUT_ALLOWED,NONE,Y\nINTERIM_BILL,NONE,Y\nMAX_MULTIPLICATION,NONE,500\nMAX_OPEN_PRICE,NONE,5000000000\nMAX_WEIGHT,NONE,0\nWR_PRINT_SLIPS,NONE,N\nWR_AUTOOPEN_NEXT_TABLE,NONE,N\nARTICLE_TRANSFER,NONE,Y\nBOOK_SYSTEM_PRICELVELS,NONE,N\nWR_SET_DATETIME,NONE,N\nWR_SET_TAPSTER_MODE,NONE,N\nWR_RESET_OWN_SALES,NONE,N\nWR_RESET_ALL_SALES,NONE,N\nWR_RESET_OWN_CREDITS,NONE,N\nWR_RESET_ALL_CREDITS,NONE,N\nWR_ALLOW_WAITER,NONE,N\nWR_DISALLOW_WAITER,NONE,N\nWR_ALLOW_TABLE,NONE,N\nWR_DISALLOW_TABLE,NONE,N\nWR_QUERY_OWN_CREDITS,NONE,N\nWR_QUERY_ALL_CREDITS,NONE,N\nWR_WEAK_MINUS_ALLOWED,NONE,N\nWR_SET_STOCKCONTROL,NONE,N\nWR_SET_STOCKCANCEL,NONE,N\nWR_SET_INVENTUR,NONE,N\nWR_ENTER_TEAM,NONE,N\nWR_LEAVE_TEAM,NONE,N\nWR_ASSIGN_TEAMROLE,NONE,N\nWR_ASSIGN_TEAMMEMBER,NONE,N\nWR_RELEASE_TEAMMEMBER,NONE,N\nWR_OPEN_TEAM,NONE,N\nWR_CLOSE_TEAM,NONE,N\nWR_LOCK_ARTICLE,NONE,Y\nWR_UNLOCK_ARTICLE,NONE,Y\nWR_SET_ARTICLE_QUANTITY,NONE,Y\nWR_TAKEOVER_TABLE,NONE,Y\nWR_HANDOVER_TABLE,NONE,Y\nWR_VIEW_LASTDOCUMENT,NONE,Y\nWR_REOPEN_LASTDOCUMENT,NONE,Y\nWR_VIEW_DOCUMENTS,NONE,Y\nWR_REOPEN_DOCUMENT,NONE,Y\nWR_VIEW_ARCHIVE_DOCUMENTS,NONE,Y\nWR_REOPEN_ARCHIVE_DOCUMENT,NONE,Y\nWR_PRINT_0_ALLOWED,NONE,N\nWR_ACTIVATE_MONITORING,NONE,N\nWR_SUBTOTAL_REQUIRED,NONE,N\nWR_CANCEL_AFTER_SUBTOTAL_PROHIBITED,NONE,N\nWR_ALLOW_NEGATIVE_COUNT,NONE,N\nWR_ALLOW_SHOW_VOUCHER,NONE,N\nWR_ALLOW_NEGATIVE_OPEN_PRICE,NONE,Y\nWR_DAYENDCLOSING_ALLOWED,NONE,N\nWR_TABLEINFO_SHOWALL,NONE,N\nWR_AUTOOPEN_TABLE_ON_BILLS,NONE,N\nWR_CLOSETABLES_ALL_ALLOWED,NONE,N\nWR_CHANGE_ONLINE_TABLES_ALLOWED,NONE,N\nWR_CHANGE_FINANCE_ALLOWED,NONE,Y\nWR_WAITER_REPORTS,NONE,10-20\nWR_ORGANIZATION_GENERIC,NONE,160-199\nWR_ORGANIZATION_CURRENT,NONE,160-199\nWR_ORGANIZATION_TODAY,NONE,160-199\nWR_ORGANIZATION_YESTERDAY,NONE,160-199\nWR_ORGANIZATION_DAY_BEFORE_YESTERDAY,NONE,160-199\nWR_ORGANIZATION_THIS_WEEK,NONE,160-199\nWR_ORGANIZATION_LAST_WEEK,NONE,160-199\nWR_ORGANIZATION_THIS_MONTH,NONE,160-199\nWR_ORGANIZATION_LAST_MONTH,NONE,160-199\nWR_ORGANIZATION_SECONDTOLAST_MONTH,NONE,160-199\nWR_ORGANIZATION_THIS_QUARTER,NONE,160-199\nWR_ORGANIZATION_LAST_QUARTER,NONE,160-199\nWR_ORGANIZATION_THIS_YEAR,NONE,160-199\nWR_ORGANIZATION_LAST_YEAR,NONE,160-199\nWR_REPORTS_DAYENDCLOSING,NONE,160-166\n
Process finished with exit code 0
Sortierung meiner Parameter zum Chef Bediener
Benutze keine Abkürzungen, was soll `cnx` sein?
Das `my` in `mycursor` ist überflüssig.
Du schließt den Cursor und die Verbindung nicht wieder ordentlich.
Und wenn Du diese Ausgabe bekommst, dann wird das wohl so in Deiner Datenbank stehen.
Niemand kennt den Aufbau und den Inhalt Deiner Daten.
Das `my` in `mycursor` ist überflüssig.
Du schließt den Cursor und die Verbindung nicht wieder ordentlich.
Und wenn Du diese Ausgabe bekommst, dann wird das wohl so in Deiner Datenbank stehen.
Niemand kennt den Aufbau und den Inhalt Deiner Daten.
@mabosu2010,
man kann an den Daten nicht wirklich den Sinn erkennen.
Was ich verstehe: Du liest ein Zeile einer MySQL Tabelle die 8 Spalten hat. Die 6. ist der Name. Die 8. ist ein großer Textblock.
Du müsstest mal beschreiben, was du mit "ordentlich strukturiert" meinst. Bis jetzt ist das mehrdeutig.
man kann an den Daten nicht wirklich den Sinn erkennen.
Was ich verstehe: Du liest ein Zeile einer MySQL Tabelle die 8 Spalten hat. Die 6. ist der Name. Die 8. ist ein großer Textblock.
Du müsstest mal beschreiben, was du mit "ordentlich strukturiert" meinst. Bis jetzt ist das mehrdeutig.