Skip to content

Instantly share code, notes, and snippets.

View ALubrano77's full-sized avatar

AndreaL77 ALubrano77

  • Italy, Lombardy
View GitHub Profile
@ALubrano77
ALubrano77 / postgresql_df_upsert.py
Created April 1, 2024 15:29 — forked from gordthompson/postgresql_df_upsert.py
Build a PostgreSQL INSERT … ON CONFLICT statement and upsert a DataFrame
# version 1.2 - 2022-10-04
import pandas as pd
import sqlalchemy as sa
def df_upsert(data_frame, table_name, engine, schema=None, match_columns=None):
"""
Perform an "upsert" on a PostgreSQL table from a DataFrame.
Constructs an INSERT … ON CONFLICT statement, uploads the DataFrame to a
@ALubrano77
ALubrano77 / ScalaHBaseExample.scala
Created September 6, 2022 07:52 — forked from ishassan/ScalaHBaseExample.scala
A hello world example about connecting Scala to HBase
//CHECK ishassan/build.sbt as well
import org.apache.hadoop.hbase.client._
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.{CellUtil, HBaseConfiguration, TableName}
import org.apache.hadoop.conf.Configuration
import scala.collection.JavaConverters._
object ScalaHBaseExample extends App{
def printRow(result : Result) = {