@thedevs · Post #1984 · 19.07.2022 г., 06:41
Things you should know about databases. #article#databases @thedevs https://kutt.it/xx2Z3i
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #241 · 5 мај
Можно ли в Python создавать бинарные файлы? Конечно можно. Для этого в Python есть следующие инструменты: ▫️ тип данных bytes и bytearray ▫️ открытие файла в режиме wb (write binary) или rb (read binary) ▫️ модуль struct Про модуль struct поговорим в первую очередь. Файл в формате JSON или Yaml внутри себя содержит разметку данных. Всегда можно определить где список начался а где закончился. Где записана строка а где словарь. То есть формат записи данных содержит в себе элементы разметки данных. В binary-файле данные не имеют визуальной разметки. Это просто байты, записанные один за другим. Правила записи и чтения находятся вне файла. Модуль struct как раз и помогает с организацией данных в таком файле с помощью определения форматов записи для разных частей файла. Модуль struct преобразует Python-объекты в массив байт, готовый к записи в файл и имеющий определённый вид. Для этого всегда следует указывать формат преобразования (или, как оно здесь называется - запаковки). Формат нужен для того, чтобы выделить достаточное количество байт для записи конкретного типа объекта. В последствии с помощью того же формата будет производиться чтение. При этом следует помнить что мы говорим о типах языка С а не Python. Именно формат определяет, что записано в конкретном месте файла, число, строка или что-то еще. Вот какие токены формата у нас есть. Помимо этого, первым символом можно указать порядок байтов. На разных системах одни и те же типы данных могут записываться по-разному, поэтому желательно указать конкретный способ из доступных. Если этого не сделать, то используется символ '@', то есть нативный для текущей системы. В строке формата мы пишем в каком порядке и какие типы собираемся преобразовать в байты. Запакуем в байты простое число, токен "i". >>> import struct >>> struct.pack('=i', 10) b'\n\x00\x00\x00' Теперь несколько float, при этом нужно передавать элементы не массивом а последовательностью аргументов. >>> struct.pack('=fff', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Вместо нескольких токенов можно просто указать нужное количество элементов перед одним токеном, результат будет тот же. >>> struct.pack('=3f', 1.0, 2.5, 4.1) b'\x00\x00\x80?\x00\x00 @33\x83@' Теперь запакуем разные типы >>> data = struct.pack('=fiQ', 1.0, 4, 100500) я запаковал типы float, int и unsigned long long (очень большой int, на 8 байт) b'\x00\x00\x80?\x04\x00\x00...' Распаковка происходит аналогично, но нужно указать тот же формат, который использовался при запаковке. Результат возвращается всегда в виде кортежа. >>> struct.unpack('=fiQ', data) (1.0, 4, 100500) Как видите, ничего страшного! #lib#basic
Пребарај: #databases
@thedevs · Post #1984 · 19.07.2022 г., 06:41
Things you should know about databases. #article#databases @thedevs https://kutt.it/xx2Z3i
Hashtags
@repo_science · Post #3374 · 30.06.2023 г., 14:57
#python#databases 🐍 Advanced Python: Working with multiple databases Description Build and connect Python Application to multiple databases 🔗Link ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----
Hashtags
@repo_science · Post #3265 · 04.06.2023 г., 22:32
#python#databases 🐍 Advanced Python: Practical Database Examples Level up as a Python developer working with databases in this advanced, skills-based course. 🔗Link ----- Main channel:@repo_science Coupons: @freecoupons_reposcience -----
Hashtags
@repo_science · Post #4219 · 20.10.2024 г., 21:14
#free#Databases 🎟 2024 Complete SQL Bootcamp from Zero to Hero in SQL 👥Students: 43024 ⭐️Ratings: 4.12 ⏳ 4.5 total hours 🌐 en_US 🗒 Limited coupons (639) 🎫 100% OFF - 💵0💲 ----- Coupons:@freecoupons_reposcience ----- ⭐️ This message was automated by 🔗n8n
Hashtags
@repo_science · Post #3381 · 03.07.2023 г., 00:51
#databases#SQL SQLBolt ¿Quieres aprender SQL de forma práctica y desde cero? SQLBolt es un recurso para devs con: ◆ Ejercicios interactivos y sencillos ◆ Ejemplos desde cero ◆ De SELECT a crear tus propias tablas ◆ 18 lecciones para aprender Es un recurso 100% gratuito. 🔗Link ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----
Hashtags
@repo_science · Post #3322 · 19.06.2023 г., 22:42
#databases#sql 🛠 SQL Server 2022 Administration Description Looking to get up to speed with the latest features of SQL Server 2022? In this course, join database analyst and trainer Eric Johnson as he covers the fundamental skills, techniques, and tools required to manage SQL Server 2022 in any development environment, regardless of your current level of experience. Learn about the new features available in the latest version of SQL Server as well as how to provision and secure Azure databases, design SQL Server tables, and tune and optimize SQL to meet your own unique needs. Throughout the course, Eric explains the relevant concepts and methodologies of managing and automating SQL Server databases, showing you how to apply what you’ve learned in a series of ongoing visual demonstrations designed to help you get hands-on practice and start building more advanced skills. 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----
Hashtags
@repo_science · Post #3402 · 07.07.2023 г., 00:57
#databases#MongoDB 💼 Learning MongoDB Get started with MongoDB. Learn how to use this popular nonrelational database to power your full-stack development workflow. ⏳2h 44m 🗣Justin Jenkins 🔗Link ----- Main channel:@repo_science Coupons: @freecoupons_reposcience -----
Hashtags
@repo_science · Post #3423 · 11.07.2023 г., 14:22
#Python#databases#sql 🐍 Data Science Fundamentals with Python and SQL Description Data science is one of the hottest professions of the decade, and the demand for data scientists who can analyze data and communicate results to inform data driven decisions has never been greater. This Specialization from IBM will help anyone interested in pursuing a career in data science by teaching them fundamental skills to get started in this in-demand field. 🗣Coursera 🔗Link ----- Main channel:@repo_science Coupons:@freecoupons_reposcience -----
Hashtags
@repo_science · Post #3158 · 09.05.2023 г., 20:18
#databases#SQL#Python 🐍 Practical SQL with Python in 3 Days using SQLite, MySQL and PostgreSQL 🔗Link ⭐Curso recomendado ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----
Hashtags
@repo_science · Post #3204 · 19.05.2023 г., 03:28
#databases#GraphQL 💾 Building Web APIs with GraphQL - The Complete Guide Become an expert in one of the most exciting web APIs framework with this practical, hands-on course 🔗Link ----- Main channel: @repo_science Coupons: @freecoupons_reposcience -----
Hashtags
@repo_science · Post #3376 · 30.06.2023 г., 22:25
#databases#sql 💾 Curso de SQL desde Cero (DALTO) 📹#youTube 🔗Link ----- Main channel: @repo_science Coupons:@freecoupons_reposcience -----
Hashtags
@githubtrending · Post #14933 · 09.07.2025 г., 12:30
#go#databases#genai#llms#mcp The MCP Toolbox for Databases helps developers connect AI agents to databases more easily and securely. It simplifies the process by handling complex tasks like connection pooling and authentication, allowing you to integrate databases with AI agents using minimal code. This toolbox supports the Model Context Protocol (MCP), which standardizes how AI interacts with external tools. By using MCP Toolbox, you can automate database tasks, query databases using natural language, and generate context-aware code, all of which save time and improve development efficiency. https://github.com/googleapis/genai-toolbox
Hashtags