django + pervasive db
Publicado por django + pervasive (2 intervenciones) el 28/11/2017 23:50:42
hello, you can connect django with pervasive, I found the sqlalchemy-pervasive, allows me from python with pervasive
Valora esta pregunta
-1
from flask import Flask, request
from flask_restful import Resource, Api
# from sqlalchemy import create_engine
# from json import dumps
# from flask.ext.jsonpify import jsonify
import pyodbc
app = Flask(__name__)
api = Api(app)
class Areras(Resource):
def get(self):
conn = pyodbc.connect('Driver={Pervasive ODBC Client Interface};ServerName=127.0.0.1;dbq=demodata2;TCPPort=1583')
cursor = conn.cursor()
cursor.execute("SELECT * FROM Areas")
respuesta = {'areas': [[i[0], i[1]] for i in cursor.fetchall()]} # Fetches first column that is Employee ID
return respuesta
api.add_resource(Areras, '/areas')
if __name__ == '__main__':
app.run(port='5002')