Skip to content

Instantly share code, notes, and snippets.

@alexmackenzie-wx
Created February 27, 2023 11:05
Show Gist options
  • Save alexmackenzie-wx/e658218390d5f8384021c0053cb94db8 to your computer and use it in GitHub Desktop.
Save alexmackenzie-wx/e658218390d5f8384021c0053cb94db8 to your computer and use it in GitHub Desktop.
import dotenv
dotenv.load_dotenv()
NEON_CONNSTRG = os.getenv("NEON_CONNSTRG")
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy import text
neon_eng = create_engine(NEON_CONNSTRG)
neon_conn = neon_eng.connect()
neon_conn.execute(
text(
"INSERT INTO nix_tweets_two (id, tweetid, tweettext, userurl) VALUES (:id, :tweetid, :tweettext, :userurl) ON CONFLICT (tweetid) DO NOTHING"
),
[{"id":nix_tweets_uuid, "tweetid": int(tweet_id), "tweettext": tweet_text, "userurl": user_url}]
)
neon_conn.commit()
@alexmackenzie-wx
Copy link
Author

created gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment