Skip to content

Instantly share code, notes, and snippets.

View andy-slac's full-sized avatar

Andy Salnikov andy-slac

View GitHub Profile
@andy-slac
andy-slac / test_cx_ora_ret.py
Last active October 24, 2019 22:17
Testing INSERT ... RETURNING with executemany() in cx_Oracle
#!/usr/bin/env python3
import cx_Oracle
def main():
db = cx_Oracle.connect(dsn="gen3_cred_salnikov")
cur = db.cursor()
data = [dict(val1=1, val2=10),
@andy-slac
andy-slac / test_returning.py
Last active October 25, 2019 18:23
Script to test how to retrieve ATOINCREMENT values
#!/usr/bin/env python3
import argparse
from sqlalchemy import create_engine, event, MetaData, Table, Column, Sequence, Integer, String
shortcuts = {"oracle": "oracle+cx_oracle://@gen3_cred_salnikov",
"sqlite": "sqlite:///test.db",
"postgres": "postgresql://"}
#!/usr/bin/env python
import argparse
from contextlib import contextmanager
import datetime
import os
import time
import uuid
from sqlalchemy import create_engine, TypeDecorator, CHAR, MetaData, Table, Column, BigInteger, DateTime, Integer