Jump to content

[Python] (Yet Another) Script for SQL Updates


Guest Patman128

Recommended Posts

Do you love applying updates by hand? No? Well, me neither, so I wrote this little Python script that runs them all for you.

Features:

- Completely cross platform, will run on OS X and some Linux out of the box. On platforms without Python, just install it and you're good to go (and who doesn't have Python anyway?)

- Counts how many updates are successful and how many are skipped!

- Gives output!

- Waits for you! (but only if you want it to ;))

http://paste2.org/p/1248633

Instructions:

- Copy/paste the script into a new file and put it in your mangos sql/updates folder. Call it something like "apply_updates.py"

On Windows:

- If you haven't already, make sure you associate python.exe with .py files (if it asks you what to open it with, browse to python.exe and make it use that.)

- Double click the script to run.

On *nix:

- Make sure to chmod u+x the file so you can execute it.

- Run it in the command line.

If you have any difficulties or questions just ask here.

Link to comment
Share on other sites

Alright, it has been updated so that it now checks the database for the last update instead of force applying all updates. Thanks to Lynx3d for his script as an example to how it can be done. :)

@darkstalker: I'm trying to keep dependencies minimal, as a SOAP client would add an extra library that would need to be installed, and mangos would have to be running for it work, as well as have SOAP enabled.

Link to comment
Share on other sites

  • 1 month later...

Nice script, some useful stuff in there - I have to admit, I'm a big python fan for knocking together band-aids around issues and this is much nicer than my approach which was a python script that went through all the update files and concat'd them together on a per db basis and then I'd just load them into the mysql cmd line client through "\\. dbscript.sql", but this is much cleaner

Is there a way of keeping the subprocess running in interactive mode and piping the individual scripts to it - this would save on creating a new DB connection for every script ?

BTW: You should use os.path.join(path,file) to concatenate a path and a file, as this is os portable and will use '/' on *nix and '\\' on MS.

Link to comment
Share on other sites

Hi there !..

im not so good on this but ehm is this an update toll that uppdates the updates for the client ???? :o

in other words.. does it fetch uppdates from the real wow and buts them to work on the P Server ?

if so this is exactly what ive been looking for !

im goin to start an swedish sever that hopfully gonna be the best wow swedish server in sweden..

if you want to conterbute help then you re more the welcome to do so..

if this is what im hoping it is please pm me directly or post an mejl to me

GREATINGS form John ! :D

Link to comment
Share on other sites

Hi there !..

im not so good on this but ehm is this an update toll that uppdates the updates for the client ???? :o

in other words.. does it fetch uppdates from the real wow and buts them to work on the P Server ?

if so this is exactly what ive been looking for !

im goin to start an swedish sever that hopfully gonna be the best wow swedish server in sweden..

if you want to conterbute help then you re more the welcome to do so..

if this is what im hoping it is please pm me directly or post an mejl or msn message to [email protected]

GREATINGS form John ! :D

It checks your database to see which updates you have applied, and then goes into your updates folder and applies any of them you haven't applied yet. It doesn't take anything from retail WoW.

I don't support private servers and I don't do house calls. Sorry. For the future, if you advertise your private server, you will get banned here.

Link to comment
Share on other sites

It checks your database to see which updates you have applied, and then goes into your updates folder and applies any of them you haven't applied yet. It doesn't take anything from retail WoW.

I don't support private servers and I don't do house calls. Sorry. For the future, if you advertise your private server, you will get banned here.

well sorry i dident know that that was an rule.. as you see ive changed that now :)

but my mail :S ?

do i have to disable users from seing my mejl therefor not being able to email me ?

:/:(

if so i think the rules is to hard..

(NOTE)

I saw now that it has the function : Hide your email address but allow form email.

so ive done that.. PEASE OUT ! :)

Link to comment
Share on other sites

  • 1 month later...
Do you love applying updates by hand? No? Well, me neither, so I wrote this little Python script that runs them all for you.

Features:

- Completely cross platform, will run on OS X and some Linux out of the box. On platforms without Python, just install it and you're good to go (and who doesn't have Python anyway?)

- Counts how many updates are successful and how many are skipped!

- Gives output!

- Waits for you! (but only if you want it to ;))

http://paste2.org/p/1076207

Instructions:

- Copy/paste the script into a new file and put it in your mangos sql/updates folder. Call it something like "apply_updates.py"

On Windows:

- If you haven't already, make sure you associate python.exe with .py files (if it asks you what to open it with, browse to python.exe and make it use that.)

- Double click the script to run.

On *nix:

- Make sure to chmod u+x the file so you can execute it.

- Run it in the command line.

If you have any difficulties or questions just ask here.

hii i've been error msg to execute your python script like this

./update.py: line 9: import: command not found

./update.py: line 10: import: command not found

./update.py: line 11: import: command not found

./update.py: line 12: import: command not found

./update.py: line 13: import: command not found

./update.py: line 20: mysql_path: command not found

./update.py: line 22: username: command not found

./update.py: line 24: password: command not found

./update.py: line 26: mangos_db: command not found

./update.py: line 28: char_db: command not found

./update.py: line 30: realm_db: command not found

./update.py: line 32: wait: `=': not a pid or valid job spec

./update.py: line 32: wait: pid 1 is not a child of this shell

./update.py: line 34: wait_secs: command not found

./update.py: line 39: syntax error near unexpected token `('

./update.py: line 39: `def error_quit():'

can you solve that's problem

Link to comment
Share on other sites

hii i've been error msg to execute your python script like this

./update.py: line 9: import: command not found

./update.py: line 10: import: command not found

./update.py: line 11: import: command not found

./update.py: line 12: import: command not found

./update.py: line 13: import: command not found

./update.py: line 20: mysql_path: command not found

./update.py: line 22: username: command not found

./update.py: line 24: password: command not found

./update.py: line 26: mangos_db: command not found

./update.py: line 28: char_db: command not found

./update.py: line 30: realm_db: command not found

./update.py: line 32: wait: `=': not a pid or valid job spec

./update.py: line 32: wait: pid 1 is not a child of this shell

./update.py: line 34: wait_secs: command not found

./update.py: line 39: syntax error near unexpected token `('

./update.py: line 39: `def error_quit():'

can you solve that's problem

Sure, run it with Python.

Link to comment
Share on other sites

hii i've been error msg to execute your python script like this

./update.py: line 9: import: command not found

./update.py: line 10: import: command not found

./update.py: line 11: import: command not found

./update.py: line 12: import: command not found

./update.py: line 13: import: command not found

./update.py: line 20: mysql_path: command not found

./update.py: line 22: username: command not found

./update.py: line 24: password: command not found

./update.py: line 26: mangos_db: command not found

./update.py: line 28: char_db: command not found

./update.py: line 30: realm_db: command not found

./update.py: line 32: wait: `=': not a pid or valid job spec

./update.py: line 32: wait: pid 1 is not a child of this shell

./update.py: line 34: wait_secs: command not found

./update.py: line 39: syntax error near unexpected token `('

./update.py: line 39: `def error_quit():'

can you solve that's problem

Sure, run it with Python.

thanx the problem is done

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...
This script need to be reconvert in C++ and insert in the mangos core,in the future if you have not got database update the core say this and say if you would update automatically.

Ye, it would be nice to have that in the core, so there is no need to worry about sql updates anymore... But a bit hard 2 do :P

Link to comment
Share on other sites

  • 2 weeks later...

Hy!

I have some errors:

------------------------------

Traceback (most recent call last):

File "D:Wow\\source code\\src\\sql\\updates\\sql_up.py", line 57, in <module>

data, errors = subprocess.Popen(query, stdout = subprocess.PIPE).communicate()

File "C:\\Python27\\lib\\subprocess.py", line 672, in __init__

errread, errwrite)

File "C:\\Python27\\lib\\subprocess.py", line 882, in _execute_child

startupinfo)

------------------------------

I use this config:

------------------------------

mysql_path = 'D:/Wow/Server/mysql/bin'

# your mysql username

username = 'root'

# your mysql password

password = 'pw'

# mangos/world database name

mangos_db = 'mangos'

# characters database name

char_db = 'characters'

# realmd database name

realm_db = 'realmd'

------------------------------

My mysql server is running on:

D:\\Wow\\Server\\mysql\\bin\\mysql.exe

------------------------------

Python rev is: v2.7.1

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use