Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
exAspArk committed Jan 3, 2025
1 parent c0e8d69 commit 5b40c49
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 2 deletions.
7 changes: 5 additions & 2 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.1/.schema/devbox.schema.json",
"packages": [
"go@latest",
"postgresql@latest"
"postgresql@latest",
"python@latest"
],
"shell": {
"init_hook": [],
"init_hook": [
". $VENV_DIR/bin/activate"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
Expand Down
57 changes: 57 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,63 @@
"store_path": "/nix/store/mjjfx6yyaaba5hmv6bga20m8fxrca93l-postgresql-16.4"
}
}
},
"python@latest": {
"last_modified": "2024-12-23T21:10:33Z",
"plugin_version": "0.0.4",
"resolved": "github:NixOS/nixpkgs/de1864217bfa9b5845f465e771e0ecb48b30e02d#python313",
"source": "devbox-search",
"version": "3.13.1",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/wn0n52lnysbscn702gfp20sx96cryiwp-python3-3.13.1",
"default": true
}
],
"store_path": "/nix/store/wn0n52lnysbscn702gfp20sx96cryiwp-python3-3.13.1"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/hskvsfyapfx5sqk5mhcylzbjpxkr51f6-python3-3.13.1",
"default": true
},
{
"name": "debug",
"path": "/nix/store/w3zkq34pfcwnwh235sqszxn3q0knq75s-python3-3.13.1-debug"
}
],
"store_path": "/nix/store/hskvsfyapfx5sqk5mhcylzbjpxkr51f6-python3-3.13.1"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/aca752v0zczhjak334ldrgfi669nhccf-python3-3.13.1",
"default": true
}
],
"store_path": "/nix/store/aca752v0zczhjak334ldrgfi669nhccf-python3-3.13.1"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/acxvfb890g9jawlxsj7zs8marxxvzrrs-python3-3.13.1",
"default": true
},
{
"name": "debug",
"path": "/nix/store/wfsagf7s6lf1pclh3a0s5m4lrhh8g6hn-python3-3.13.1-debug"
}
],
"store_path": "/nix/store/acxvfb890g9jawlxsj7zs8marxxvzrrs-python3-3.13.1"
}
}
}
}
}
3 changes: 3 additions & 0 deletions metabase.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker pull metabase/metabase:latest
docker run -d -p 3000:3000 --name metabase --platform linux/amd64 metabase/metabase
# test@example.com / 1test@example.com
31 changes: 31 additions & 0 deletions psycopg2-test-pg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import psycopg2
from psycopg2 import Error

try:
# Connect to an existing database
connection = None
connection = psycopg2.connect(
user="bemidb",
password="bemidb",
host="127.0.0.1",
port="5432",
database="tpch"
)

print("Connected")
cursor = connection.cursor()

print("Querying")
# cursor.execute("SELECT 1")
cursor.execute("SET datestyle TO 'ISO'")
record = cursor.fetchone()
print("You are connected to - ", record)

except (Exception, Error) as error:
print("Error while connecting to PostgreSQL:", error)

finally:
if connection:
cursor.close()
connection.close()
print("PostgreSQL connection is closed")
30 changes: 30 additions & 0 deletions psycopg2-test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import psycopg2
from psycopg2 import Error

try:
# Connect to an existing database
connection = None
connection = psycopg2.connect(
user="bemidb",
password="bemidb",
host="127.0.0.1",
port="54321",
database="bemidb"
)

print("Connected")
cursor = connection.cursor()

print("Querying")
cursor.execute("SELECT 1")
record = cursor.fetchone()
print("You are connected to - ", record)

except (Exception, Error) as error:
print("Error while connecting to PostgreSQL:", error)

finally:
if connection:
cursor.close()
connection.close()
print("PostgreSQL connection is closed")
2 changes: 2 additions & 0 deletions psycopg2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip install psycopg2-binary
python psycopg2-test.py

0 comments on commit 5b40c49

Please sign in to comment.