Skip to content

Commit

Permalink
Fixed removing header in csv files when loading snowflake
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelene committed Mar 16, 2022
1 parent a187a1f commit d1821ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
32 changes: 18 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
FROM python:3.8-slim

# Installing Oracle instant client
# Installing Oracle instant client and support for odbc
WORKDIR /opt/oracle
RUN apt-get update \
&& apt-get install -y gcc g++ unixodbc unixodbc-dev libaio1 wget unzip git \
&& wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip \
&& unzip instantclient-basiclite-linuxx64.zip \
&& rm -f instantclient-basiclite-linuxx64.zip \
&& cd /opt/oracle/instantclient* \
&& rm -f *jdbc* *occi* *mysql* *README *jar uidrvci genezi adrci \
&& echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf \
&& ldconfig
&& wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip \
&& wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-sqlplus-linux.x64-21.5.0.0.0dbru.zip \
&& unzip instantclient-basic-linux.x64-21.5.0.0.0dbru.zip \
&& unzip instantclient-sqlplus-linux.x64-21.5.0.0.0dbru.zip \
&& rm -f instantclient-basic-linux.x64-21.5.0.0.0dbru.zip \
&& rm -f instantclient-sqlplus-linux.x64-21.5.0.0.0dbru.zip \
&& cd /opt/oracle/instantclient* \
&& rm -f *jdbc* *occi* *mysql* *README *jar uidrvci genezi adrci \
&& echo /opt/oracle/instantclient* > /etc/ld.so.conf.d/oracle-instantclient.conf \
&& ldconfig

WORKDIR /
ENV PATH /opt/oracle/instantclient_21_5:$PATH

COPY eneel /eneel
COPY example_connections.yml /
COPY example_project.yml /
COPY setup.py /

# install dependencies
# RUN pip install git+https://github.com/mikaelene/eneel.git
WORKDIR /
COPY eneel /eneel
COPY setup.py /
RUN python setup.py install

# If you want to install the latest version from git
# RUN pip install git+https://github.com/mikaelene/eneel.git
5 changes: 3 additions & 2 deletions eneel/adapters/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def run_import_file(account,
+ table_format
+ " type = 'CSV' field_delimiter = '"
+ delimiter
+ "' skip_header = 1; "
#+ "' skip_header = 1; "
+ "'; "
)
logger.debug(create_format_sql)
db.execute(create_format_sql)
Expand Down Expand Up @@ -449,7 +450,7 @@ def import_file(self, schema, table, path, delimiter=","):

def generate_create_table_ddl(self, schema, table, columns):
try:
create_table_sql = "CREATE TABLE " + schema + "." + table + "(\n"
create_table_sql = "CREATE TRANSIENT TABLE " + schema + "." + table + "(\n"
for col in columns:

ordinal_position = col[0]
Expand Down

0 comments on commit d1821ca

Please sign in to comment.