remove switch to _row for pg backend
This commit is contained in:
4
Makefile
4
Makefile
@ -7,13 +7,13 @@ test_pg: export DATABASE_URL=postgresql://username:password@localhost:5432/tests
|
|||||||
test_pg:
|
test_pg:
|
||||||
docker-compose -f scripts/docker-compose.yml up -d postgres
|
docker-compose -f scripts/docker-compose.yml up -d postgres
|
||||||
bash scripts/test.sh -svv
|
bash scripts/test.sh -svv
|
||||||
docker-compose stop postgres
|
docker-compose -f scripts/docker-compose.yml stop postgres
|
||||||
|
|
||||||
test_mysql: export DATABASE_URL=mysql://username:password@127.0.0.1:3306/testsuite
|
test_mysql: export DATABASE_URL=mysql://username:password@127.0.0.1:3306/testsuite
|
||||||
test_mysql:
|
test_mysql:
|
||||||
docker-compose -f "scripts/docker-compose.yml" up -d mysql
|
docker-compose -f "scripts/docker-compose.yml" up -d mysql
|
||||||
bash scripts/test.sh -svv
|
bash scripts/test.sh -svv
|
||||||
docker-compose stop mysql
|
docker-compose -f scripts/docker-compose.yml stop mysql
|
||||||
|
|
||||||
test_sqlite:
|
test_sqlite:
|
||||||
bash scripts/test.sh -svv
|
bash scripts/test.sh -svv
|
||||||
@ -369,9 +369,6 @@ class ModelRow(NewBaseModel):
|
|||||||
and values are database values
|
and values are database values
|
||||||
:rtype: Dict
|
:rtype: Dict
|
||||||
"""
|
"""
|
||||||
# databases does not keep aliases in Record for postgres, change to raw row
|
|
||||||
source = row._row if cls.db_backend_name() == "postgresql" else row
|
|
||||||
|
|
||||||
selected_columns = cls.own_table_columns(
|
selected_columns = cls.own_table_columns(
|
||||||
model=cls, excludable=excludable, alias=table_prefix, use_alias=False,
|
model=cls, excludable=excludable, alias=table_prefix, use_alias=False,
|
||||||
)
|
)
|
||||||
@ -381,6 +378,6 @@ class ModelRow(NewBaseModel):
|
|||||||
alias = cls.get_column_name_from_alias(column.name)
|
alias = cls.get_column_name_from_alias(column.name)
|
||||||
if alias not in item and alias in selected_columns:
|
if alias not in item and alias in selected_columns:
|
||||||
prefixed_name = f"{column_prefix}{column.name}"
|
prefixed_name = f"{column_prefix}{column.name}"
|
||||||
item[alias] = source[prefixed_name]
|
item[alias] = row[prefixed_name]
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|||||||
@ -6,4 +6,4 @@ DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///test.db")
|
|||||||
database_url = databases.DatabaseURL(DATABASE_URL)
|
database_url = databases.DatabaseURL(DATABASE_URL)
|
||||||
if database_url.scheme == "postgresql+aiopg": # pragma no cover
|
if database_url.scheme == "postgresql+aiopg": # pragma no cover
|
||||||
DATABASE_URL = str(database_url.replace(driver=None))
|
DATABASE_URL = str(database_url.replace(driver=None))
|
||||||
print('USED DB:', DATABASE_URL)
|
print("USED DB:", DATABASE_URL)
|
||||||
|
|||||||
Reference in New Issue
Block a user