Dockerfile
FROM debian:bookworm-slim
RUN apt update && apt install -y lftp
Send from terminal
docker run -v $(pwd)/file_to_send:/tmp/file_to_send \
Dockerfile
FROM debian:bookworm-slim
RUN apt update && apt install -y lftp
Send from terminal
docker run -v $(pwd)/file_to_send:/tmp/file_to_send \
""" | |
Short example of how to set realtionship in many-to-many with extra column(s) in association table. | |
creator class is used on the relationship(), but it's also possible to create MUserPermitAssoc | |
explicitly and pass it to MUser.permits. | |
""" | |
from __future__ import annotations | |
import sqlalchemy as sa |
class MyCUstomResponse(JSONResponse): | |
def __init__( | |
self, | |
data: list[t.Any], | |
errors: list[t.Any] | None = None, | |
status_code: int = 200, | |
headers: dict[str, str] | None = None, | |
media_type: str | None = None, | |
background: BackgroundTask | None = None, | |
) -> None: |
import re | |
from sqlalchemy.orm import DeclarativeBase, declared_attr | |
def resolve_table_name(name): | |
"""Resolve table name from Class CamelCase""" | |
# Match a letter just before an upper-case char | |
# Example: "Hello World" would match "o" because next "W" is uppercase. |
class AsyncTyper(typer.Typer): | |
def __init__(self, *args, **kwargs): | |
kwargs["no_args_is_help"] = True | |
super().__init__(*args, **kwargs) | |
def async_command(self, *args, **kwargs): | |
def decorator(async_func): | |
@wraps(async_func) | |
def sync_func(*_args, **_kwargs): |
from sqlalchemy.engine import Connection | |
from sqlalchemy.ext.asyncio import AsyncEngine | |
from app.core.config import get_config | |
app_config = get_config() | |
config.set_main_option("sqlalchemy.url", app_config.postgres.dsn) |
from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from pydantic.dataclasses import dataclass
# Create engine and session
engine = create_engine('sqlite:///example.db')
Session = sessionmaker(bind=engine)
session = Session()