@tomasienrbc  I've got this working for me.  I'm dumping my full notes here.  
Pay special attention to "MODIFY SUPERSET CODE FILES" section.  This section 
reshapes values to fit in superset.  If I understand correctly, the changes 
that I made to dataframe.py may need to be refactored into db_engines_spec.py


# *************** Install DREMIO connectors on Ubuntu ***************
# Install unixodbc - prerequisite to dremio-odbc
sudo apt-get install unixodbc-dev unixodbc-bin unixodbc

# Install dremio-odbc 
curl -o dremio-odbc-1.3.19.1052-1.x86_64.rpm 
https://download.dremio.com/odbc-driver/1.3.19.1052/dremio-odbc-1.3.19.1052-1.x86_64.rpm
sudo apt-get install alien
sudo alien -i dremio-odbc-1.3.19.1052-1.x86_64.rpm 

# *************** Build sqlalchemy_dremio ***************

# clone sqlalchemy_dremio dialect repository:
git clone https://github.com/sqggles/sqlalchemy_dremio.git
cd sqlalchemy 
make clean

# builds source and wheel package.  The make file referenced python2, so I 
pulled the commands out and changed to python3:
python3 setup.py sdist
python3 setup.py bdist_wheel
ls -l dist

# run tests
python3 sqlalchemy_dremio/tests/conftest.py 


# install the package to the active python3's site-packages
python3 setup.py install


# *************** MODIFY SUPERSET CODE FILES *************

superset/sql_lab.py:  
import sqlalchemy_dremio.pyodbc #add this line below import sqlalchemy

superset/dataframe.py:

Change from:
        self.column_names = dedup(
            db_engine_spec.get_normalized_column_names(cursor_description))

        data = data or []

        self.df = (
            pd.DataFrame(list(data), columns=column_names).infer_objects())

Change to:
        self.column_names = dedup(
            db_engine_spec.get_normalized_column_names(cursor_description))

        data = data or []

        #customized:
        colcount = len(column_names)
        rowcount = len(data)
        data = np.reshape(data, (rowcount, colcount))

        self.df = (
            pd.DataFrame(list(data), columns=column_names).infer_objects())

# *************** RESTART SUPERSET ***************
# Restart superset
systemctl restart superset.service

# *************** DREMIO ADMIN ***************
# Login to dremio
# Create user in dremio

# *************** Create Datasource in Superset ***************
# Create database connection with URI example below.  See 
sqlalchem_dremio/tests/test_sql_alchemy_dremio.py for more info.
# I used:
dremio+pyodbc://user:password@dremioipaddress:31010/mydremiodatasourcename



[ Full content available at: 
https://github.com/apache/incubator-superset/issues/4192 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to