Created
February 27, 2023 11:05
-
-
Save alexmackenzie-wx/e658218390d5f8384021c0053cb94db8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
created gist