Re: [Tutor] How to call mysqlcommand in Python , "mysqldump for backup "

2005-12-28 Thread nephish
Glad to help, glad you got it working too.!

shawn


On Wed, 2005-12-28 at 09:03 +, John Joseph wrote:
> --- nephish <[EMAIL PROTECTED]> wrote:
> 
> > ooh ooh, i know this one, i have python do this for
> > me every day !
> > 
> > target_dir = '/path/to/where/you/want/to/dump'
> > 
> > os.system("mysqldump --add-drop-table -c -u user
> > -ppassword database
> > table > "+target_dir+"/table.bak.sql")
> > 
> > dont forget the p in front of your password !
> > 
> > hope this helps
> > 
> > 
> 
>   Hi it  helped me a lot ,
>   I did my script like this  for backing my zabbix
> database 
> 
> import os, time
> # difine the target directory
> target_dir = '/home/john/backup/z-b-weekly/zabbix'
> 
> # in the formar year-month-day-hours-minute-secound
> # uses  time module
> today =  time.strftime('%Y-%m-%d-%H-%M-%S')
> 
> # For testing purpose only I had kept %M %S , we can
> remove it later
> now = target_dir + today
> 
> os.system("mysqldump  -u root -pjohn zabbix >  
> "+now+"  " )
>   Thanks  A LOT 
>   Joseph 
> 
>  
> 
> 
> 
>   
> ___ 
> To help you stay safe and secure online, we've developed the all new Yahoo! 
> Security Centre. http://uk.security.yahoo.com
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to call mysqlcommand in Python , "mysqldump for backup "

2005-12-28 Thread John Joseph

--- nephish <[EMAIL PROTECTED]> wrote:

> ooh ooh, i know this one, i have python do this for
> me every day !
> 
> target_dir = '/path/to/where/you/want/to/dump'
> 
> os.system("mysqldump --add-drop-table -c -u user
> -ppassword database
> table > "+target_dir+"/table.bak.sql")
> 
> dont forget the p in front of your password !
> 
> hope this helps
> 
> 

  Hi it  helped me a lot ,
  I did my script like this  for backing my zabbix
database 

import os, time
# difine the target directory
target_dir = '/home/john/backup/z-b-weekly/zabbix'

# in the formar year-month-day-hours-minute-secound
# uses  time module
today =  time.strftime('%Y-%m-%d-%H-%M-%S')

# For testing purpose only I had kept %M %S , we can
remove it later
now = target_dir + today

os.system("mysqldump  -u root -pjohn zabbix >  
"+now+"  " )
  Thanks  A LOT 
  Joseph 

 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to call mysqlcommand in Python , "mysqldump for backup "

2005-12-27 Thread nephish
ooh ooh, i know this one, i have python do this for me every day !

target_dir = '/path/to/where/you/want/to/dump'

os.system("mysqldump --add-drop-table -c -u user -ppassword database
table > "+target_dir+"/table.bak.sql")

dont forget the p in front of your password !

hope this helps


On Tue, 2005-12-27 at 13:07 +, John Joseph wrote:
> Hi 
> I am trying to execute some MySQL commands using
> some python scripts 
>   I want to do a “mysqldump” of my database “john” to
> a file backup.date.sql
> the normal command  to take a dump is 
>  mysqldump  john> backup.sql
> 
>   I tried python , by importing 
>  “import os”
> but  I am stuck in  how to call “mysqldump” in
> python and execute it 
>   Help and guidance requested
>Thanks 
> Joseph 
> 
> 
> 
>   
> ___ 
> NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
> online! http://uk.cars.yahoo.com/
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How to call mysqlcommand in Python , "mysqldump for backup "

2005-12-27 Thread John Joseph
Hi 
I am trying to execute some MySQL commands using
some python scripts 
  I want to do a “mysqldump” of my database “john” to
a file backup.date.sql
the normal command  to take a dump is 
 mysqldump  john> backup.sql

  I tried python , by importing 
 “import os”
but  I am stuck in  how to call “mysqldump” in
python and execute it 
  Help and guidance requested
   Thanks 
Joseph 




___ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
online! http://uk.cars.yahoo.com/
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor