Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Salnikov andy-slac

View GitHub Profile
View test_uuid_db.py
#!/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
@andy-slac
andy-slac / test_cx_ora_ret.py
Last active Oct 24, 2019
Testing INSERT ... RETURNING with executemany() in cx_Oracle
View test_cx_ora_ret.py
#!/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 Oct 25, 2019
Script to test how to retrieve ATOINCREMENT values
View test_returning.py
#!/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://"}