Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How to remove blank lines using vi editor command Linux/Unix
  • To find all disk io ( EMC as well as local) Linux/Unix
  • Global Unique Identifier Generation in Oracle 9.2 SYS_GUID() Oracle
  • Python class import from different folders Python/PySpark
  • My FTP Job Scheduling for www.pvmehta.com PHP/MYSQL/Wordpress
  • move_arch_files.ksh Linux/Unix
  • FGA Part-I Oracle
  • Locktree.sql Oracle
  • Roles and Stored Object behaviour Oracle
  • Good links for x$ tables in oracle. Oracle
  • How can I tell if ASO is installed ? Oracle
  • How to find the real execution plan and binds used in that explain plan in Oracle 10g?? Oracle
  • catting.sh Linux/Unix
  • sbind.sql Find Bind variable from sql_id sqlid Oracle
  • Backup and Recovery Scenarios Oracle

Category: Python/PySpark

How to connect to Oracle Database with Wallet with Python.

Posted on 21-Mar-2025 By Admin No Comments on How to connect to Oracle Database with Wallet with Python.

To connect Python to Oracle Database using an Oracle Wallet, you can use the cx_Oracle or oracledb library with Oracle Client libraries (like Oracle Instant Client). Oracle Wallet simplifies secure connections by storing credentials and SSL certificates. ✅ Steps to Connect Python to Oracle using Oracle Wallet Step 1: Install Required Python Package Step 2:…

Read More “How to connect to Oracle Database with Wallet with Python.” »

Oracle, Python/PySpark

Reading config file from other folder inside class

Posted on 24-Sep-2024 By Admin No Comments on Reading config file from other folder inside class

Directory Structure: root-folder/ config-folder/ json-file.config class-folder/ classfile.py tests/ pytest-file1.py json-file.config: { “setting1”: “value1”, “setting2”: “value2” } Now, Here I need to access json-file.config in my class file. I do not want to use dbutil, how can i access it and read it from json-file.config in my class file?? classfile.py import os import json class myclass:…

Read More “Reading config file from other folder inside class” »

Python/PySpark

Python class import from different folders

Posted on 22-Sep-202422-Sep-2024 By Admin No Comments on Python class import from different folders

I have following directory structure.  root-folder – config-folder  json-file.config – class-folder  classfile.py – tests pytest-file1.py Now, I need to use a class named myclass from classfile.py in my test/pytestfile1.py. How can I import that class in my pytest file?? To import the myclass from classfile.py into your pytest-file1.py, you can use a relative import assuming…

Read More “Python class import from different folders” »

Python/PySpark

Add new columns in dataframe

Posted on 30-Sep-202301-Oct-2023 By Admin No Comments on Add new columns in dataframe

from pyspark.sql.functions import col, lit# File location and typefile_location = “/FileStore/tables/sales_data_part1.csv”file_type = “csv”# CSV optionsinfer_schema = “false”first_row_is_header = “true”delimiter = “,”# The applied options are for CSV files. For other file types, these will # be ignored.df = spark.read.format(file_type) .option(“inferSchema”, infer_schema) .option(“header”, first_row_is_header) .option(“sep”, delimiter) .load(file_location)display(df)# Adding new column with and with default values. #…

Read More “Add new columns in dataframe” »

Python/PySpark

Getting started with notebook

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Getting started with notebook

# Databricks notebook source   %sqlcreate database if not exists abcdb   %sqluse abcdb   %sqlcreate table student (id int , name string)   %sqlinsert into studentselect 1 as id, ‘user1’ as name   %sqlselect * from student   spark.sql(“create database if not exists xyzdb”)spark.sql(“use xyzdb”)   # Use three double quotes (“””) if SQL…

Read More “Getting started with notebook” »

Python/PySpark

Read CSV file using PySpark

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Read CSV file using PySpark

from pyspark.sql.functions import col   # File location and type file_location = “/FileStore/tables/sales_data_part1.csv” file_type = “csv” # CSV options infer_schema = “false” first_row_is_header = “true” delimiter = “,” # The applied options are for CSV files. For other file types, these will be ignored. df = spark.read.format(file_type)   .option(“inferSchema”, infer_schema)   .option(“header”, first_row_is_header)   .option(“sep”,…

Read More “Read CSV file using PySpark” »

Python/PySpark

Read CSV File using Python

Posted on 30-Sep-202330-Sep-2023 By Admin No Comments on Read CSV File using Python

# Databricks notebook source import pandas as pd # preapre dataframe df_h=pd.read_csv(“https://people.sc.fsu.edu/~jburkardt/data/csv/zillow.csv”) #Print dataframe df_h #define custom columns columns = [“Srno”, “SQFT”, “BR”, “Baths”, “Zipcode”, “YearBuilt”, “ListPrice”] df_h=pd.read_csv(“https://people.sc.fsu.edu/~jburkardt/data/csv/zillow.csv”, header=None, names=columns) #Print dataframe df_h # show top 10 rows df_h.head(10) # show last 10 rows df_h.tail(10) #Print dataframe df_h #Drop non-needed columns, column names are case…

Read More “Read CSV File using Python” »

Python/PySpark

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (387)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (336)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024
  • Add new columns in dataframe30-Sep-2023

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Processes parameter and its dependencies on OS kernel parameters Linux/Unix
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • process id based files and processes Linux/Unix
  • Rollback force for distributed transactions Oracle
  • To Find Orphan OS processes. Linux/Unix
  • 751131.1 New Article Error 2819 While Requesting a Systemstate Dump Oracle
  • The most important Tuning Notes Oracle
  • oracle 10g on linux Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme