Comments - Could you suggest a connector which can work for Django and mariaDB?

7 years, 9 months ago CP Wen

Hi Bryan, Sorry, Maybe I expressed a wrong meaning. I wanted to know whick DB API Drivers(like https://docs.djangoproject.com/ja/1.9/ref/databases/#mysql-db-api-drivers) can work good for MariaDB. . I have visited the web site you suggested. I can't install the package "libmariadbclient-dev" for the Ubuntu 15.10. I checked the package in "Ubuntu Packages Search". The package is only for Ubuntu 14.04. I don't know why the new version Ubuntu doesn't have the package.

Maybe I have to tell you the whole story why I need to find another DB API Drivers for MariaDB. First thought, I need DATETIME type column can store fractional seconds in Database. I think MariaDB 10 supports it. But I don't know why I can't implement it. Then I tried to use the sqlite which builds in Django as database. It works. I use PyMySQL as DB API Driver for MariaDB now. So I though PyMySQL maybe have a bug.

But my friend can implement it using MySQL. His work environment is Python 3.5.1+, Django 1.9.5, PyMySQL 0.7.4, ubuntu 16.04. It is almost like mine, although the versions are sort of different. The only difference is that he doesn't use MariaDB as database. So I confuse which node is wrong. Could you give me some suggestions how to clarify the question? Thanks a lot.

 
7 years, 9 months ago Bryan Alsdorf

Internally we are using mysql-python but any of the three should work.

Have you added our repositories to your system? With those added I was able to install libmariadbclient-dev with no problem.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386] http://mirror.jmu.edu/pub/mariadb/repo/10.0/ubuntu wily main'

sudo apt-get update
sudo apt-get install libmariadbclient-dev

sudo apt-get install python-pip build-essential python-dev libssl-dev

# you only need to install one of these, not both. However they both worked for me
sudo pip install MySQL-python 
sudo pip install mysqlclient

Unfortunately I am not running on python 3 or Django 1.9 so I can't confirm that microseconds work with those but according to the documentation they do. If they do not, please provide the exact error you are getting and I will try to help.

 
7 years, 9 months ago CP Wen

I removed mariadb-server first. Then I followed your steps. It works. Yes.

I followed the installation in your web site before. Could you tell me that why it doesn't have "sudo apt-get install mariadb-server" in your steps? Your web site has the installation step.

And I had removed the mariadb-server. I wonder why it can still work?

 
7 years, 9 months ago Bryan Alsdorf

My steps didn't have mariadb-server as my test environment was connecting to an instance of MariaDB on another machine.

If you are running MariaDB on the same machine you will need to install mariadb-server, otherwise you do not need it.

 
7 years, 9 months ago CP Wen

I have some summaries for the question.

1. Re-install MariaDB to solve the problem that can't install the package "libmariadbclient-dev". "libmariadbclient-dev" is prerequisite for mysqlclient package. 2. PyMySQL can work well in the "fractional seconds" function with MySQL, not MariaDB. 3. I use mysqlclient in place of PyMySQL. Because mysqlclient can work well with MariaDB, and I think it is easier to use.

Thanks a lot for all your help, Bryan.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.