*document/api.py* def test(): import pandas as pd from sqlalchemy import create_engine
data = {'Name': ['Alex', 'Ronald', 'Jane'], 'Age': [10, 18, 33] } df = pd.DataFrame(data) table = 'stifix' #engine = create_engine('sqlite://', echo = False) engine = create_engine('sqlite:///test.db', echo = False) df.to_sql(table, con = engine, if_exists = 'append') #engine.execute("SELECT * FROM %s" % table).fetchall() rows = engine.execute("SELECT * FROM %s" % table).fetchall() return rows *terminal* $ curl -X GET -i http://localhost:8000/document/api/test HTTP/1.1 200 OK X-Powered-By: web2py Content-Type: text/html; charset=utf-8 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Expires: Sun, 13 Feb 2022 08:20:18 GMT Pragma: no-cache Date: Sun, 13 Feb 2022 08:20:18 GMT Server: Rocket 1.2.6 Python/3.8.12 Transfer-Encoding: Chunked Connection: keep-alive curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding *note * code is work well when in execute in pure python terminal (started from import pandas till print(rows) ) *objective * can update database directly from REST API using sqlalchemy and pandas *question* how to do it using web2py way ? thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/568bcfb8-acc5-4e89-86d5-67292b6fc956n%40googlegroups.com.