0

mysql error on apache server on godaddy

I am doing a full stack project. in that i am using godaddy python app and database. wordentrysyntax = f"INSERT INTO {tablename} ({wordcol},{meaningcol},{hint1col},{hint2col},{wordlengthcol},{addedbycol},{classcol},{chaptercol}) VALUES (%s, %s, %s,%s, %s, %s, %s,%s)" valuesofword=(word,meaning,hint1,hint2,wordlength,email,class1,chapter) cursor.execute(wordentrysyntax,valuesofword) while executing this i mean calling some thing like above method i am getting 502 BAD GATE ERROR. Please help me to solve it

25th Oct 2024, 6:06 PM
CHENNAMSETTY SUMANTH
CHENNAMSETTY SUMANTH - avatar
4 odpowiedzi
+ 2
It could be a number of things. If some queries work and some do not, it's likely to be throttling. GoDaddy has code in place to limit your activity. To deal with that, if you are making many calls (like importing data), you may need to slow down in between inserts. A lot of web hosting companies offer you what looks like unlimited, or massive, allotments. But at the same time, they have throttles in place to prevent you from using the so-called unlimited resources. I don't know if that's your situation. I've had hosting companies that were so hard to use because they kept canceling queries. Sometimes it's not about the frequency of queries but could be the length of time a particular query runs. They give you so many "ticks" and kill the query. So a query that takes long to run, even if it doesn't return data, can be canceled. That makes certain operations impossible. I see your code has a cursor - not sure if your code is running a lot - but that's probably the issue. Here is a page with a number of ideas on what to try: https://www.problogguru.com/godaddy-502-bad-gateway/ If you are able to run simple operations but not bigger operations, you may be forced to upgrade your account or find a different hosting provider. Personally, i prefer VPS accounts because my resources don't get throttled like that. Using THEIR database instance is how they restrict you. If you get a VPS, you have to manage your own database inside the CPU/Memory you pay for. VPS account typically restrict memory or storage but do not have tight restrictions on CPU utilization. Where shared hosting restricts CPU activity but offer unlimited storage.
25th Oct 2024, 6:19 PM
Jerry Hobby
Jerry Hobby - avatar
0
Hello sir. Thanks for responding. I am able to retrive daat. when i try to edit the data then only error is comming
25th Oct 2024, 6:49 PM
CHENNAMSETTY SUMANTH
CHENNAMSETTY SUMANTH - avatar
0
I’m certain simple edits on small selections will work. But anything like a batch or complex query won’t work. For that you might have have to break it into many very small operations. If you are data scrubbing , do one record at a time with two seconds in between. Try limiting your usage to a single transaction and if that works then you know they are throttling you. Otherwise you may need a better hosting company.
25th Oct 2024, 11:22 PM
Jerry Hobby
Jerry Hobby - avatar
0
Are you just dumping your code to godaddy? Usually we have a local environment and cloud environment which are as identical as possible. Any way the error is not related to the sql query. Its a connection error.
28th Oct 2024, 3:30 PM
Toni Isotalo
Toni Isotalo - avatar