Skip to content
Advertisement

Tag: python-3.x

Translate Oracle query into pandas dataframe handling

I have the below dataframe: PARAM1 PARAM2 VALUE A X TUE, WED A Y NO B X MON, WED B Y YES I would like a pythonic way of obtaining the distinct values of param1 that satisfy EITHER of these conditions: Their corresponding param2 = ‘X’ contains the string ‘MON’ Their corresponding param2 = ‘Y’ is equal to ‘YES’. In

Problem in a function that extracts and saves fields from a database table to another

If in the combo_Nations combobox I select a specific Country (the country name is extracted from the “All_Nations” table in the “Nations_name” column), I would like to get the corresponding ID_Nations of the respective selected country (ID_Nations is found in the same table “All_Nations”). The ID will be automatically inserted in another table of the database together with other fields,

Efficient syntax to update 5K rows in BQ table

I’m trying to update ~5K rows in bq using python client. Here is my current try: and How can I map the account id list to a string as follows which seems more efficient(?) UPDATE mytable SET somefield=( CASE WHEN (id=100) THEN ‘some value removed’ WHEN (id=101) THEN ‘some value removed’ END ) WHERE id IN (100,101); I’ve tried: Plus

is there a method to conect to postgresql (dbeaver ) from pyspark?

hello i installed pyspark now and i have a database postgres in local in DBeaver : how can i connect to postgres from pyspark please i tried this but i have an error Answer You need to add the jars you want to use when creating the sparkSession. See this : https://spark.apache.org/docs/2.4.7/submitting-applications.html#advanced-dependency-management Either when you start pyspark or when you

Sqlite3 in Python not fetching data

I have a sqlite3 DB with a few rows in it. When I try to fetch data from it in Python, fetchall returns an empty list. The data is being inserted in a different part of the project fine. I verified this by opening the DB in “DB Browser for SQLite” and running the following command. This returned the data

Advertisement