>source

firebase를 사용하여 폴더 (.csv 파일 포함)를 dB로 저장하고 싶습니다. 그러나 나는 그것을하지 못하고있다. 제발 도와주세요.

   import os
from firebase import firebase
firebase = firebase.FirebaseApplication("https://face-crime.firebaseio.com/")
path = r'C:\Users\Jshei\Desktop\Criminal Face\Crime 
    Record'
    files = []
     # r=root, d=directories, f = files
    for r, d, f in os.walk(path):
    for file in f:
    if '.csv' in file:
    files.append(os.path.join(r, file))
for f in files:
print(f)

  • 답변 # 1

    import pyrebase
    
    # This is a SDK from firebase
    config = {
        "apiKey": "your API key",
        "authDomain": "you domain",
        "databaseURL": "your db url",
        "projectId": "your id",
        "storageBucket": "bucket name",
        # Don't forget to format the "double-quotes" for the strings, firebase not make that!
        "messagingSenderId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "appId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "measurementId": "xxxxxxxxxxxxxx"
    }
    firebase = pyrebase.initialize_app(config)  # data from the config
    storage = firebase.storage()  # storage of database
    storage.child("Crime Record csv files/Crime Record_2020-08-28_21-37-01.csv").put(
        r"/home/folio/Desktop/xxxxxxxxxx.csv") #make sure to put 'r'
    # Crime Record is a folder in project in the firebase, Crime Record xxx=xxx=xxx.csv is the file where the Crime info.
    # is stored, has a location to fetch the data from the Crime Record.
    
    storage.child("Crime Record Images/xxxxxx.jpg").put(
        r"/home/folio/Desktop/xxxxxxxxxxxx.jpg")
    # Crime Record is a folder in project in the firebase, TrainingImage xxx-xxx.jpg is the file where the Crime info. is
    # stored, has a location to fetch the data from the TrainingImage.
    
    

관련 자료

  • 이전 javascript - 바인딩에 null 참조 전달
  • 다음 javascript - 반응 후크 기능 구성 요소의 검색 결과를 기반으로 자식 구성 요소 업데이트