Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dcf2d79
Restore support for linking embedded library
Shelnutt2 Nov 6, 2019
21d6521
Rename package and update README
Shelnutt2 Nov 8, 2019
8e038be
Add dockerfile and azure pipelines to build docker
Shelnutt2 Nov 8, 2019
d9de0af
Add errmsg.sys to install in module path
Shelnutt2 Nov 10, 2019
a38c88d
Set languages/lc_messages_dir to module path
Shelnutt2 Nov 10, 2019
dd55b54
Set datadir by default to temp directory
Shelnutt2 Nov 10, 2019
ee937b6
Use setuptools scm for versioning
Shelnutt2 Nov 10, 2019
6e6dd0e
If db is not set to test db so array queries work
Shelnutt2 Nov 10, 2019
7081f77
Upgrade setuptools in dockerfile
Shelnutt2 Nov 10, 2019
744df49
Update final workdir in Dockerfile
Shelnutt2 Nov 10, 2019
e6ae924
Update metadata.cfg
Shelnutt2 Nov 10, 2019
0657a26
Use only version.py
Shelnutt2 Nov 11, 2019
377cd90
Update Dockerfile latest MariaDB/TileDB versions
Shelnutt2 Feb 6, 2020
2cc6252
Add support for github tar archives in building, needed for conda
Shelnutt2 Feb 6, 2020
0f1ef55
Remove PyInt_FromLong usage
Shelnutt2 Jun 5, 2020
cec6d78
Remove remaining python2 support
Shelnutt2 Jun 5, 2020
e4085c9
Disable embedded linking for travis ci
Shelnutt2 Jun 5, 2020
bfdeb7e
Format with black
Shelnutt2 Jun 5, 2020
7278247
Add back missing server_init import from _mysql
Shelnutt2 Jun 5, 2020
ebb4a62
Fix segfault on null connection with error
Shelnutt2 Jun 5, 2020
1eff703
Remove double import of _mysql package
Shelnutt2 Jun 5, 2020
1dec3c6
Create test db for ci tests, since its now defaulted
Shelnutt2 Jun 5, 2020
62daf67
Remove __version__ tests
Shelnutt2 Jun 5, 2020
e60c68a
Update dockerfile to TileDB 2.2 and MyTile 0.7
Shelnutt2 Feb 2, 2021
f6b1a97
Fix formatting
Shelnutt2 Feb 3, 2021
ecd52bd
FIx flake8 test
Shelnutt2 Feb 3, 2021
734c55e
disable django 2.2 test
ericawithlove208 Feb 3, 2021
e552a28
Merge pull request #8 from TileDB-Inc/ss/update-dockerfile-for-ci-til…
ericawithlove208 Feb 3, 2021
2b2865b
remove mysql library init call
ericawithlove208 Feb 4, 2021
16e4a71
Merge pull request #9 from TileDB-Inc/erica/ch5172/remove-mysql-libra…
ericawithlove208 Feb 4, 2021
a1c38e9
Use atexit to only shutdown MariaDB on module exit
Shelnutt2 Feb 4, 2021
fe18775
Merge pull request #10 from TileDB-Inc/sethshelnutt/ch5190/only-shutd…
Shelnutt2 Feb 4, 2021
257d3b2
Update docker image for latest TileDB and MyTile
Shelnutt2 Jan 26, 2022
256ee31
Merge pull request #11 from TileDB-Inc/ss/update-docker-image
Shelnutt2 Jan 26, 2022
00755e7
Install SQLAlchemy in Docker image (#12)
jdblischak Feb 10, 2023
c328cdc
Change mysql includes to use ```<>```
DimitrisStaratzis Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
build/
dist/
MySQLdb/release.py
tiledb/sql/release.py
.coverage
.idea
tiledb/sql/version.py
46 changes: 25 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,49 @@ before_script:
- "mysql --help"
- "mysql --print-defaults"
- "mysql -e 'create database mysqldb_test charset utf8mb4;'"
- "mysql -e 'create database test charset utf8mb4;'"

script:
# Disable embedded for travis CI
- sed -i 's/embedded = True/embedded = False/g' site.cfg
- pip install -e .
- pytest --cov ./MySQLdb
- pytest --cov ./tiledb/sql

after_success:
- codecov

jobs:
fast_finish: true
include:
- &django_2_2
name: "Django 2.2 test"
env:
- DJANGO_VERSION=2.2.7
python: "3.5"
install:
- pip install -U pip
- wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz
- tar xf ${DJANGO_VERSION}.tar.gz
- pip install -e django-${DJANGO_VERSION}/
- cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/
- pip install .
#- &django_2_2
# name: "Django 2.2 test"
# env:
# - DJANGO_VERSION=2.2.7
# python: "3.5"
# install:
# - pip install -U pip
# - wget https://github.com/django/django/archive/${DJANGO_VERSION}.tar.gz
# - tar xf ${DJANGO_VERSION}.tar.gz
# - pip install -e django-${DJANGO_VERSION}/
# - cp ci/test_mysql.py django-${DJANGO_VERSION}/tests/
# - sed -i 's/embedded = True/embedded = False/g' site.cfg
# - pip install .

before_script:
- mysql -e 'create user django identified by "secret"'
- mysql -e 'grant all on *.* to django'
- mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql
# before_script:
# - mysql -e 'create user django identified by "secret"'
# - mysql -e 'grant all on *.* to django'
# - mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql

script:
- cd django-${DJANGO_VERSION}/tests/
- ./runtests.py --parallel=1 --settings=test_mysql
# script:
# - cd django-${DJANGO_VERSION}/tests/
# - ./runtests.py --parallel=1 --settings=test_mysql
- name: flake8
python: "3.8"
install:
- pip install -U pip
- pip install flake8
script:
- flake8 --ignore=E203,E501,W503 --max-line-length=88 .
- flake8 --ignore=E203,E501,W503,E402 --max-line-length=88 .
- name: black
python: "3.8"
install:
Expand Down
139 changes: 139 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
FROM ubuntu:20.04
LABEL maintainer="support@tiledb.io"

ENV AWS_EC2_METADATA_DISABLED true

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=GMT

RUN apt-get update && apt-get install -y \
gosu \
pwgen \
tzdata \
gcc \
g++ \
build-essential \
libasan5 \
bison \
chrpath \
cmake \
gdb \
gnutls-dev \
libaio-dev \
libboost-dev \
libdbd-mysql \
libjudy-dev \
libncurses5-dev \
libpam0g-dev \
libpcre3-dev \
libreadline-gplv2-dev \
libstemmer-dev \
libssl-dev \
libnuma-dev \
libxml2-dev \
lsb-release \
perl \
psmisc \
zlib1g-dev \
libcrack2-dev \
cracklib-runtime \
libjemalloc-dev \
libsnappy-dev \
liblzma-dev \
libzmq3-dev \
uuid-dev \
ccache \
git \
wget \
python3 \
python3-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

ENV MTR_MEM /tmp

WORKDIR /tmp

ENV TILEDB_VERSION="2.6.2"

# Install tiledb using 2.6 release
RUN mkdir build_deps && cd build_deps \
&& git clone https://github.com/TileDB-Inc/TileDB.git -b ${TILEDB_VERSION} && cd TileDB \
&& mkdir -p build && cd build \
&& cmake -DTILEDB_VERBOSE=OFF -DTILEDB_S3=ON -DTILEDB_SERIALIZATION=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j$(nproc) \
&& make install-tiledb \
&& cd /tmp && rm -r build_deps

ENV MARIADB_VERSION="mariadb-10.5.13"

ARG MYTILE_VERSION="0.12.1"

# Download mytile release
RUN wget https://github.com/TileDB-Inc/TileDB-MariaDB/archive/${MYTILE_VERSION}.tar.gz -O /tmp/${MYTILE_VERSION}.tar.gz \
&& tar xf /tmp/${MYTILE_VERSION}.tar.gz \
&& mv TileDB-MariaDB-${MYTILE_VERSION} mytile

# Copy example arrays to opt
RUN cp -r /tmp/mytile/mysql-test/mytile/test_data/tiledb_arrays /opt/

# Install curl after building tiledb
RUN apt-get update && apt-get install -y \
libcurl4 \
libcurl4-openssl-dev \
&& rm -rf /var/lib/apt/lists/*

RUN wget https://downloads.mariadb.org/interstitial/${MARIADB_VERSION}/source/${MARIADB_VERSION}.tar.gz \
&& tar xf ${MARIADB_VERSION}.tar.gz \
&& mv /tmp/mytile ${MARIADB_VERSION}/storage/mytile \
&& cd ${MARIADB_VERSION} \
&& mkdir builddir \
&& cd builddir \
&& cmake -DPLUGIN_INNODB=NO \
-DPLUGIN_TOKUDB=NO \
-DPLUGIN_ROCKSDB=NO \
-DPLUGIN_MROONGA=NO \
-DPLUGIN_SPIDER=NO \
-DPLUGIN_SPHINX=NO \
-DPLUGIN_FEDERATED=NO \
-DPLUGIN_FEDERATEDX=NO \
-DPLUGIN_CONNECT=NO \
-DPLUGIN_PERFSCHEMA=NO \
-DCMAKE_BUILD_TYPE=Release \
-SWITH_DEBUG=0 \
-DWITH_EMBEDDED_SERVER=ON \
-DCMAKE_INSTALL_PREFIX=/opt/server .. \
&& make -j$(nproc) \
&& make install \
&& cd ../../ \
&& rm -r ${MARIADB_VERSION}

# Add server binaries to path
ENV PATH="${PATH}:/opt/server/bin"

# Set ld library paths
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/usr-local.conf
RUN echo "/usr/local/lib64" >> /etc/ld.so.conf.d/usr-local.conf
RUN echo "/opt/server/lib" >> /etc/ld.so.conf.d/usr-local.conf
RUN echo "/opt/server/lib64" >> /etc/ld.so.conf.d/usr-local.conf
RUN echo "/opt/server/lib/plugin" >> /etc/ld.so.conf.d/usr-local.conf
RUN echo "/opt/server/lib64/plugin" >> /etc/ld.so.conf.d/usr-local.conf

RUN ldconfig /usr/local/lib

ADD . /opt/tiledb-sql-py

WORKDIR /opt/tiledb-sql-py

# Newer setup tools needed for find_namespace_packages
RUN pip3 install --upgrade setuptools

RUN pip3 install -r requirements.txt

RUN pip3 install .

RUN pip3 install pandas numpy tiledb sqlalchemy

WORKDIR /opt/

CMD ["python3"]
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ include site.cfg
include setup_common.py
include setup_posix.py
include setup_windows.py
include tiledb/sql/errmsg.sys
86 changes: 46 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,77 @@

[![Build Status](https://secure.travis-ci.org/PyMySQL/mysqlclient-python.png)](http://travis-ci.org/PyMySQL/mysqlclient-python)

This is a fork of [MySQLdb1](https://github.com/farcepest/MySQLdb1).
This is a fork of [mysqlclient-python](https://github.com/PyMySQL/mysqlclient-python).

This project adds Python 3 support and bug fixes.
I hope this fork is merged back to MySQLdb1 like distribute was merged back to setuptools.
This project is designed to be used with TileDB-SQL which is a reduced build of MariaDB with support for using
the [MyTile](https://github.com/TileDB-Inc/TileDB-MariaDB) storage engine for accessing TileDB Arrays.

This is not meant to be used a general purpose MariaDB Client, it is only meant to be used with linking against
the embedded version of MariaDB. This has been tested only with MariaDB 10.4 and the MyTile storage engine.

## Support
# Install

**Do Not use Github Issue Tracker to ask help. OSS Maintainer is not free tech support**
## Docker

When your question looks relating to Python rather than MySQL:
A docker image is available on dockerhub under [tiledb/tiledb-sql-py](https://hub.docker.com/r/tiledb/tiledb-sql-py/).
This docker image will drop you into a python shell and has tiledb, tiledb-sql-py, pandas and numpy preinstalled.

* Python mailing list [python-list](https://mail.python.org/mailman/listinfo/python-list)
* Slack [pythondev.slack.com](https://pyslackers.com/web/slack)
```
docker run -it --rm tiledb/tiledb-sql-py
```

Or when you have question about MySQL:
## Conda

* [MySQL Community on Slack](https://lefred.be/mysql-community-on-slack/)
Conda packages will be available on conda forge soon.

```
conda install -c conda-forge tiledb-sql
```

## Install
## Pypi

### Windows
A pypi package will be build from conda using conda-press

Building mysqlclient on Windows is very hard.
But there are some binary wheels you can install easily.
```
pip install tiledb-sql
```

### macOS (Homebrew)
## Compiling From Source

Install MySQL and mysqlclient:
### Prerequisites

```
# Assume you are activating Python 3 venv
$ brew install mysql
$ pip install mysqlclient
```
You may need to install the Python development headers and compile MariaDB from source

If you don't want to install MySQL server, you can use mysql-client instead:
#### Python development headers

```
# Assume you are activating Python 3 venv
$ brew install mysql-client
$ echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
$ export PATH="/usr/local/opt/mysql-client/bin:$PATH"
$ pip install mysqlclient
```
* `sudo apt-get install python-dev default-libmysqlclient-dev` # Debian / Ubuntu
* `sudo yum install python-devel mysql-devel` # Red Hat / CentOS
* `brew install mysql-connector-c` # macOS (Homebrew) (Currently, it has bug. See below)

On Windows, there are binary wheels you can install without MySQLConnector/C or MSVC.

### Linux
#### Compiling MyTile

**Note that this is a basic step. I can not support complete step for build for all
environment. If you can see some error, you should fix it by yourself, or ask for
support in some user forum. Don't file a issue on the issue tracker.**
Please follow the [MyTile compilation instructions](https://docs.tiledb.com/developer/mariadb/installation)

You may need to install the Python 3 and MySQL development headers and libraries like so:
### Building TileDB-SQL-Py package

* `$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential` # Debian / Ubuntu
* `% sudo yum install python3-devel mysql-devel` # Red Hat / CentOS
If you've installed mytile into `$HOME/mytile_server` simply build the python package with:

```
PATH="$HOME/mytile_server/bin:${PATH}" python setup.py build_ext --inplace
```

Then you can install mysqlclient via pip now:
Now you can use it with

```
$ pip install mysqlclient
import tiledb.sql
import pandas
db = tiledb.sql.connect(db="test")
pd.read_sql(sql="select * from `s3://my_bucket/my_array`, con=db)
```

### Documentation
# Documentation

Documentation is hosted on [Read The Docs](https://mysqlclient.readthedocs.io/)
Documentation is hosted on [TileDB Developer Docs](https://docs.tiledb.com/developer/api-usage/running-sql)

Loading