question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Connection closed by server: input data too slow'

See original GitHub issue

cartoframes version: 1.0b1

when I write a dataframe with shape (159811, 26), it failed with this Error Message

CartoException: [u'Connection closed by server: input data too slow']

CartoExceptionTraceback (most recent call last)
<command-3936245970158062> in <module>()
----> 1 dj.write(data8, 'data8_sample', overwrite=True)

/local_disk0/pythonVirtualEnvDirs/virtualEnv-815f9d21-7f16-4535-965c-e17131b11050/local/lib/python2.7/site-packages/cartoframes/context.pyc in write(self, df, table_name, temp_dir, overwrite, lnglat, encode_geom, geom_col, **kwargs)
    349             if_exists = Dataset.REPLACE
    350 
--> 351         dataset.upload(with_lnglat=lnglat, if_exists=if_exists, table_name=table_name, context=self)
    352 
    353         tqdm.write('Table successfully written to CARTO: {table_url}'.format(

/local_disk0/pythonVirtualEnvDirs/virtualEnv-815f9d21-7f16-4535-965c-e17131b11050/local/lib/python2.7/site-packages/cartoframes/data/dataset.pyc in upload(self, with_lnglat, if_exists, table_name, schema, context)
    419                 raise already_exists_error
    420 
--> 421             self._copyfrom(with_lnglat)
    422 
    423         elif self._query is not None:

/local_disk0/pythonVirtualEnvDirs/virtualEnv-815f9d21-7f16-4535-965c-e17131b11050/local/lib/python2.7/site-packages/cartoframes/data/dataset.pyc in _copyfrom(self, with_lnglat)
    553             """COPY {table_name}({columns},the_geom)
    554                FROM stdin WITH (FORMAT csv, DELIMITER '|');""".format(table_name=self._table_name, columns=columns),
--> 555             self._rows(self._df, [c for c in self._df.columns if c != 'cartodb_id'], with_lnglat, geom_col)
    556         )
    557 

/local_disk0/pythonVirtualEnvDirs/virtualEnv-815f9d21-7f16-4535-965c-e17131b11050/local/lib/python2.7/site-packages/carto/sql.pyc in copyfrom(self, query, iterable_data, compress, compression_level)
    382             raise e
    383         except Exception as e:
--> 384             raise CartoException(e)
    385 
    386         return response_json

CartoException: [u'Connection closed by server: input data too slow']

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
andy-eschcommented, Dec 2, 2019

Just tried this and didn’t experience the reported issues.

I mocked Dongjie’s dataset like so:

N = 110000
visits = {f"n_{n}": [randint(0, 25) for _ in range(N)] for n in range(24)}
visits["quadkey_id"] = (
    "".join(np.random.choice(list("0123"), size=16)) for _ in range(N)
)

# then create the polygon from the quadkey

df = gpd.GeoDataFrame(visits)
CartoDataFrame(df).to_carto(table_name="iss908_test", if_exists='replace')

The shape is approximately the same as the one Dongjie tried to upload as are most other data qualities.

1reaction
andy-eschcommented, Dec 3, 2019

Btw: you can create a CartoDataFrame directly from the visits variable.

Yes, it works! 😃 I was trying to save time with things I knew worked so didn’t want to risk it before. Turns out it would’ve saved me 15 seconds 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileZilla connection closed by server - How to fix - Bobcares
Commonly seen causes for this error include having too many simultaneous connections, any Firewall issue, antivirus restrictions, incorrect ...
Read more >
ERR_CONNECTION_CLOSED: What It Is and 3 Ways to Fix It
ERR_CONNECTION_CLOSED is a server-side error that occurs on Google Chrome. Learn what it is, what causes it, and 3 ways to fix the...
Read more >
How To Fix "ERR_CONNECTION_CLOSED" in Chrome (13 ...
Seeing the ERR_CONNECTION_CLOSED message in Chrome? Here are 13 easy-to-follow troubleshooting steps to fix the problem for good.
Read more >
7 Reasons Why Your Internet is Slow (and How to Fix It)
A simple restart of your modem and your router (or all-in-one wireless gateway) can sometimes speed up your connection.
Read more >
What happens when client closes connection before server is ...
Sometimes we get a timeout exception in the middle of reading from the stream. My working theory is that the connection is being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found