Category : sql

Hi Guys, I tried to use this code through python to run sql-server script import pyodbc # ‘driver = ‘SQL Server’ host = ‘**DESKTOP-A2HRFI1SQLSERVER**’ db1 = ‘master’ tcon = ‘yes’ # uname = ‘jnichol3’ # pword = ‘**my-password**’ cnxn = pyodbc.connect(driver='{SQL Server}’, host, db1, trusted_Connection=tcon) cursor = cnxn.cursor() cursor.execute("SELECT TOP (1000) [Student_name],[Serial_no]FROM [master].[dbo].[StudentTable]") rows = ..

Read more

I have been trying to fix this, why doesn’t the offset variable change its value? @app.route("/", methods = ["GET", "POST"]) @login_required def index(): global offset if request.method == "POST": if request.form[‘next’] == "Next": offset += 12 pokes = db.execute(f"SELECT id, name, type, url FROM dex LIMIT 12 OFFSET {offset}") return render_template("index.html", pokes = pokes) if ..

Read more

from pyspark.sql import functions as f class Outlier(): def __init__(self, df): self.df = df def _calculate_bounds(self): bounds = { c: dict( zip(["q1", "q3"], self.df.approxQuantile(c, [0.25, 0.75], 0)) ) for c, d in zip(self.df.columns, self.df.dtypes) if d[1] in ["bigint", "double"] } for c in bounds: iqr = bounds[c][‘q3’] – bounds[c][‘q1’] bounds[c][‘min’] = bounds[c][‘q1’] – (iqr * ..

Read more

I’m a beginner with Django and Python but I need some help to parse my sql query to Django query set. I have a database which contains a table called "Temperatura". Models: from django.db import models from datetime import datetime Create your models here. class Temperatura(models.Model): data = models.DateField(default=datetime.now, unique=True) maxima = models.DecimalField(max_digits=5, decimal_places=2) minima ..

Read more