Skip to content

Commit

Permalink
Fix connection refused error
Browse files Browse the repository at this point in the history
  • Loading branch information
Saleh Hindi committed Jun 3, 2017
1 parent cc3ec30 commit 61e8e64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 1 addition & 3 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,7 @@ def csv_to_df(filepath_or_buffer, sep, header, names, index_col, squeeze,
dayfirst, thousands, decimal, quotechar, escapechar, comment,
encoding, error_bad_lines, chunksize):
# Use Pandas to parse csv file to a dataframe
upload_path = 'http://' + config['SUPERSET_WEBSERVER_ADDRESS'] + ':' \
+ str(config['SUPERSET_WEBSERVER_PORT']) \
+ url_for('uploaded_file', filename=filepath_or_buffer)
upload_path = config['UPLOAD_FOLDER'] + filepath_or_buffer
# Expose this to api so can specify each field
chunks = pandas.read_csv(filepath_or_buffer=upload_path,
sep=sep,
Expand Down
9 changes: 5 additions & 4 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,18 +647,19 @@ def test_user_profile(self, username='admin'):

def test_import_csv(self):
self.login(username='admin')
config = app.config

test_file = open('tests/testCSV.csv', 'w+')
os.environ['SUPERSET_CONFIG'] = 'tests.superset_test_config'
con = app.config.get('SQLALCHEMY_DATABASE_URI')

test_file = open('tests/testCSV.csv', 'w+')
test_file.write(u'Column 1, Column 2\n')
test_file.write(u'Test1, Test 2')
test_file.write(u'Test 1, Test 2')
test_file.seek(0)

form_data = {'csv_file': test_file,
'sep': ',',
'name': 'TestName',
'con': config['SQLALCHEMY_DATABASE_URI'],
'con': con,
'if_exists': 'append',
'index_label': 'test_label',
'chunksize': 1,
Expand Down

0 comments on commit 61e8e64

Please sign in to comment.