Skip to content

Instantly share code, notes, and snippets.

Avatar

Elias Coutinho CoutinhoElias

View GitHub Profile
View my_code.py
''' USO PEEWEE PARA GERAR MEUS DADOS DIRETAMENTE DO POSTGRES'''
''' MEUS MODELOS PODEM SER ABSTRAIDOS DO EXEMPLO '''
from ntpath import join
from peewee import fn, JOIN
from models import Detalhe, Produto, Grupo, Familia, Unidade, Pessoas, Estoque, Codigos, Docitem, Comitem
import pandas as pd
from datetime import datetime
''' ABAIXO CRIO MINHA CONSULTA PARA USAR NOS GRÁFICOS '''
View pandas_df.py
from dash import Dash
from dash_html_components import Div, H1, P, H3
from dash_core_components import Graph, Dropdown, Slider, Checklist
from dash.dependencies import Input, Output
from random import randint
import pandas as pd
app = Dash(__name__)
@CoutinhoElias
CoutinhoElias / sub_query.py
Last active Sep 8, 2022
Subquery on peewee
View sub_query.py
# When referencing a table multiple times, we'll call Model.alias() to create
# a secondary reference to the table.
EstoqueAlias = Estoque.alias()
# Create a subquery that will calculate the maximum Post timestamp for each
# user.
subquery = (EstoqueAlias
.select(
EstoqueAlias.iddetalhe,
fn.MAX(EstoqueAlias.dtreferencia).alias('max_ts'))
@CoutinhoElias
CoutinhoElias / peewee.py
Created Aug 6, 2022
Solução para Join com peewee.
View peewee.py
# Observando o Join na consulta abaixo pode observar que o nome das tabelas não se repetem
p = Estoque.select(
Detalhe.cdprincipal,
Detalhe.dsdetalhe,
Produto.stativo,
Grupo.nmgrupo,
Familia.dsfamilia,
Detalhe.vlprecocusto,
View my_code.py
from kivymd.uix.button import MDFillRoundFlatButton, MDRaisedButton
from kivymd.font_definitions import theme_font_styles
from kivymd.uix.label import MDLabel
import json
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd import images_path
from kivymd.uix.expansionpanel import MDExpansionPanel, MDExpansionPanelOneLine
View my_error.py
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton
from kivy.properties import ListProperty
from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen
from kivymd.uix.card import MDCard
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.behaviors import TouchBehavior
from kivy.lang import Builder
@CoutinhoElias
CoutinhoElias / meu_peewee.py
Last active Jan 14, 2022
Descobrir_um_bug
View meu_peewee.py
from ast import Try
from peewee import *
from peewee import SqliteDatabase, Model, TextField, ForeignKeyField
import xmltodict
import glob, os
# Abre a base de dados que receberá as informações dos XML'
database = SqliteDatabase('/home/elias/Área de Trabalho/notas_emissor/NfEasy2.db')
@CoutinhoElias
CoutinhoElias / explicando_pyrebase_1.py
Last active Dec 29, 2021
Parte 1, explicando pyrebase.
View explicando_pyrebase_1.py
# A primeira coisa que você deve fazer é criar seu ambiente virtual.
# Quer saber como? Assista nosso segundo vídeo desta playlist.
# Ambiente de desenvolvimento VirtualEnv:
# https://www.youtube.com/watch?v=OR0gACGD0-Q
source kivy_venv/bin/activate
# Em seguida instalaremos a biblioteca Pyrebase
pip3 install pyrebase
@CoutinhoElias
CoutinhoElias / import_xml_nfe.py
Last active Nov 3, 2021
Importar XML de NF-E
View import_xml_nfe.py
from peewee import *
from peewee import SqliteDatabase, Model, TextField, ForeignKeyField
import xmltodict
import glob, os
database = SqliteDatabase('C:\\DadosNFeasy\\Data\\NfEasy2.db')
class UnknownField(object):
View blob_field.py
My traceback
'''
<class 'kivy.core.image.Image'>
Traceback (most recent call last):
File "/home/elias/Documentos/PROGRAMACAO/1-PYTHON/1-KIVY/PROJETOS/1-KIVYMD/Curso/Desk/main.py", line 126, in <module>
AppDesktop().run()
File "/home/elias/Documentos/PROGRAMACAO/kivy_venv/lib/python3.9/site-packages/kivy/app.py", line 949, in run
self._run_prepare()
File "/home/elias/Documentos/PROGRAMACAO/kivy_venv/lib/python3.9/site-packages/kivy/app.py", line 919, in _run_prepare
root = self.build()