Я понимаю, что это ошибка новичков в Python, однако я не уверен, почему я получаю ошибку: NameError: имя 'conn' не определено когда я определил conn в функция:
Код: Выделить всё
conn = connection.connect(connectionProperties, log)
Полный код выглядит следующим образом:< /p>
Код: Выделить всё
import snowflake.snowpark as snowpark
from snowflake.snowpark.functions import col
import wheel_loader
def getStruct(conn):
wheel_loader.load('whlib-0.0.1-py3-none-any.whl')
from whlib.utils import connectionProperties as connProps
from whlib.utils import connection as connection
from whlib.utils import whliblogging as log
from whlib.cln import entity as entity
dbConnectionProperties = connProps.DbConnectionProperties()
dbConnectionProperties.DBServer = 'xxxxxxxxxxx'
dbConnectionProperties.DBUser = 'xxxxxxx'
dbConnectionProperties.DBPword = 'xxxxxxxxxx'
dbConnectionProperties.DBDatabase = 'xxxxxxxxxxxxxxxxx'
connectionProperties = connProps.ConnectionProperties()
connectionProperties.dbConnectionProperties = dbConnectionProperties
log = logs.Logging(connectionProperties)
conn = connection.connect(connectionProperties, log)
def main(session: snowpark.Session):
return getStruct(conn)
Подробнее здесь: https://stackoverflow.com/questions/763 ... ot-defined