Friday, August 2, 2013

Re: Django App - Accessing Remote MySQL Database

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJR+6z/AAoJECtGpaYHamaxU3AQAIYFwTLQ0JdScmt0sTmwlUGZ
kXE+kIQhQVG/KOcRT3JNrGFkg/KWwXV5+Wre44mbLhQT1f/EC2yxA7TRMEk/rao3
aiMnfUQYcDj+mQJUJvCYey0y5YBEdJNqgx/fVA1u0izxma8cscVCJo6ankoQHL2B
hrx7dJUFKTsxt3aQOV/8/RXCC46tM79jGv2rgcemis1EhEBeCgYXcrl76Hr3PGMu
fHJ7F7dR9Hmg3rdKFETF/gv5eEJa5HfGeh3bD+ARHliULjUpZI52IQiZPicupdDL
eU6ZtvhYQYWLJGokK+HcLiuN9vcLB+r7Pe7E3+BWi/dd/QwNQZd5lAMgaVwdfBQK
C+CN3Bab3+gEjU86QOjO6uEOII7OrbW2877LliJ4FNCwVmSN9ky14jrzZ3rsapum
Btr9t74u93e2/QkeFVisnYEDYteA+D81ex5KQmgpYEFCDZn38Nk106FRIfEuZKjs
tR+0biQjKxzK+9JeNILiDAEiWeNDQr+EvqMOrrFoPnkK9sJtjOOuOxsiE05i3ca0
rXzszEwAXlxnRbDUeKSU0HSknU4dQjhcaemAnc2YE28//+jnmxcwNNihI/L5x3tF
vSTaPBgEJ+JYIZeJO0JJYZzUzuhn6JF51rHbwvQ0BB8UANFSwLgF6FauZOCxrXT+
AlCYXPn8/ls6zhCvoV23
=wLVc
-----END PGP SIGNATURE-----
On Thu, 1 Aug 2013 17:50:35 -0700 (PDT)
Ji Park <jhprks@gmail.com> wrote:

> Hello, I'm trying to make an app that can periodically access a remote
> mysql database.
>
> This app will query the remote database and copy some data to the local
> postgresql database.
>
> So far I know that celery can be used to schedule periodic tasks, but I'm
> not sure what to do about querying the remote mysql database server.
>
> Should I just use python's MySQLdb module, does anyone know any other
> python module that I can use to query mysql db?
>
> Would this even be a good way to access remote database server from a
> django app? I'll have to be running a function that is within tasks.py
> periodically (via celery-django), would there be any better way to access
> remote mysql server from a django app in this case?
>

Depends on whether you want ORM or not, I guess. You could use
SQLAlchemy or even Django's database abstraction for accessing the
remote database.

As a side-note, I hope you won't be pumping data directly to database
used by Django (i.e. raw) - since you'll be bypassing all model checks
that you may have built-in in your models.

Best regards

--
Branko Majic
Jabber: branko@majic.rs
Please use only Free formats when sending attachments to me.

Бранко Мајић
Џабер: branko@majic.rs
Молим вас да додатке шаљете искључиво у слободним форматима.

No comments:

Post a Comment