-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
82 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=8529 | ||
DB_NAME=quranref | ||
DB_USERNAME=kashif | ||
DB_PASSWORD=compulife | ||
DB_COLLECTION=ayas | ||
#DB_COLLECTION=[ayas,surahs,words,aya_texts,has,texts] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
import sys | ||
from typing import Optional | ||
import typer | ||
#from database_conn import * | ||
from pyramid.paster import get_appsettings, setup_logging | ||
from quranref.scripts.surah_info_import import * | ||
from quranref.scripts.text_import import * | ||
from quranref.scripts.populate import * | ||
|
||
app = typer.Typer() | ||
quranref_app = typer.Typer() | ||
app.add_typer(quranref_app, name="quranref") | ||
|
||
@quranref_app.command("quranref_populate") | ||
def quranref_populate(val:str): | ||
populate_main("quranref_populate development.ini") | ||
print("quranref_populate development.ini") | ||
|
||
@quranref_app.command("quranref_import_surah_info") | ||
def quranref_scripts_surah_info_import(val:str): | ||
surah_info_import("quranref_import_surah_info development.ini") | ||
print("quranref_import_surah_info development.ini") | ||
|
||
@quranref_app.command("quranref_import_text") | ||
def quranref_import_text(val:str): | ||
text_import_main("quranref_import_text development.ini "+ val) | ||
print("quranref_import_text development.ini") | ||
|
||
|
||
if __name__=="__main__": | ||
app() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from pydantic import BaseSettings | ||
#import pyArango.connection as conn | ||
from arango import ArangoClient | ||
|
||
class Settings(BaseSettings): | ||
DB_HOST: str | ||
DB_PORT: int | ||
DB_NAME: str | ||
DB_USERNAME: str | ||
DB_PASSWORD: str | ||
DB_COLLECTION: str | ||
|
||
class Config: | ||
env_file = '.env' | ||
|
||
|
||
def get_settings(): | ||
return Settings() | ||
|
||
|
||
settings = get_settings() | ||
client = ArangoClient() | ||
db = client.db(settings.DB_NAME,username=settings.DB_USERNAME, password=settings.DB_PASSWORD) | ||
#db =conn.Connection(username=settings.DB_USERNAME, password=settings.DB_PASSWORD).databases[settings.DB_NAME] | ||
if not db.has_collection(settings.DB_COLLECTION): | ||
ayasCollection = db.create_collection(settings.DB_COLLECTION) | ||
else: | ||
ayasCollection = db.collection(settings.DB_COLLECTION) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters