Skip to content

Instantly share code, notes, and snippets.

View ThirVondukr's full-sized avatar

Doctor ThirVondukr

  • 01:54 (UTC +03:00)
View GitHub Profile
@ThirVondukr
ThirVondukr / main.py
Last active November 6, 2023 03:13
Redis/In-Memory pub-sub with multicast and client side routing
import asyncio
import contextlib
import random
import traceback
from collections import defaultdict
from collections.abc import AsyncIterator, Callable, Hashable
from types import TracebackType
from typing import (
TYPE_CHECKING,
Generic,
@ThirVondukr
ThirVondukr / main.py
Last active March 14, 2022 11:50
Strawberry GraphQL Cursor Pagination
import base64
import enum
from typing import Any, Optional, Annotated
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import InstrumentedAttribute, DeclarativeMeta
from sqlalchemy.sql import Select
from gql.modules.users._fields import UserOrder
@ThirVondukr
ThirVondukr / sqla.py
Created January 11, 2022 03:47
Querying relationship count using SQLAlchemy
from sqlalchemy import Table, Integer, Column, ForeignKey, String, create_engine, select, func
from sqlalchemy.orm import declarative_base, relationship, sessionmaker, column_property, undefer
Base = declarative_base()
engine = create_engine("sqlite://", echo=True)
Session = sessionmaker(bind=engine, future=True)
article_tags = Table(
"article__tags",
Base.metadata,
@ThirVondukr
ThirVondukr / filters.py
Last active October 6, 2021 23:36
Strawberry Input types generation
import dataclasses
import typing
from types import SimpleNamespace
from typing import Optional, List
import strawberry
class Op(SimpleNamespace):
eq = "eq"